title: Categorizing MailMerge on ONE Page - Directory/Catalogue
body: <p>I am trying to get the mail merge work with directory as the source that would help me categorize the records in my current template. </p>
  
  <p>I am using this field code: <code>{QUOTE{IF{MERGESEQ}=1{SET Key ""}}"{IF{MERGEFIELD Description}&lt;&gt; {KEY}"{IF{MERGESEQ}&gt;1"
  "}
  Values for {MERGEFIELD Description}{SET Key{MERGEFIELD Description}}
  Input
  "}{MERGEFIELD ColDesc}
  "}</code></p>
  
  <p>Now the output I get is fine for a new fresh document, but when I try this code with an existing template, what it outputs is a document for each record it merges. </p>
  
  <p>What I would like to have is a kind of this output on one page: </p>
  
  <pre><code>Details for the record selected from the file provided:
  
  
  Values for 'Subjects'
  Input
  Study ID
  Class ID
  Subject Name
  Student ID
  
  Values for 'Visits'
  Input
  Visit ID
  Visit date
  Room No.
  Summary 
  etc.....
  </code></pre>
  
  <p>But what my output is the following:</p>
  
  <pre><code>Details for the record selected from the file provided:
  Values for 'Subjects'
  Input
  Study ID
  Class ID
  Subject Name
  Student ID
  
  
  Details for the record selected from the file provided:
  Values for 'Visits'
  Input
  Visit ID
  Visit date
  Room No.
  Summary
  </code></pre>
  
  <p>All suggestions are appreciated. </p>
  
  <p>Best </p>