title: Using a field from tablestart in another tablestart MS Word merge
body: <p>I am setting up a mail merge document with an object data source that has an object containing this structure:</p>
  
  <p><em>id, firstName, lastName, address, donationText, donations</em></p>
  
  <p>donations is an object itself with the following attributes:</p>
  
  <p><em>donationType, donationAmount, donationDate</em></p>
  
  <p>The mail merge document uses the mergefield TableStart and TableEnd to control the object data to use.  For example, to use the firstName and lastName fields you have to use TableStart like this.</p>
  
  <pre><code>{MERGEFIELD TableStart:person}
  {MERGEFIELD firstName} {MERGEFIELD lastName}
  {MEREFIELD TableEnd:person}
  </code></pre>
  
  <p>Since donations is an object, you have to use it using TableStart/TableEnd to access those fields.</p>
  
  <pre><code>{MERGEFIELD TableStart:person}
  {MERGEFIELD firstName} {MERGEFIELD lastName}
  
  {MERGEFIELD TableStart:donation}
  {MERGEFIELD donationType}
  {MERGEFIELD TableEnd:donation}
  
  {MERGEFIELD TableEnd:person}
  </code></pre>
  
  <p>You cannot use fields from person inside the TableStart/TableEnd for donation or vice-versa.  What I need to do is to be able to check the donationType and if it is CHK or ECHECK then insert the donationText.  I figured out you can use an IF statement like this:</p>
  
  <pre><code>{MERGEFIELD TableStart:person}
  {MERGEFIELD firstName} {MERGEFIELD lastName} 
  {IF "{MERGEFIELD TableStart:donation}{MERGEFIELD donationType}{MERGEFIELD TableEnd:donation}" = "CHK" "{MERGEFIELD donationText}" ""}
  {IF "{MERGEFIELD TableStart:donation}{MERGEFIELD donationType}{MERGEFIELD TableEnd:donation}" = "ECHECK" "{MERGEFIELD donationText}" ""}
  {MERGEFIELD TableEnd:person}
  </code></pre>
  
  <p>I can get this statement to work if each IF statement is in a separate line.  I need them to be in the same line to prevent blank lines from appearing.  I also tried embedding one IF statement in the other but then neither of the IF statements work.</p>
  
  <p>I am using MS Word 2010.</p>