4W WebMerge Tag Reference

WM-IndexLabel

Syntax
[WM-IndexLabel: FieldName]
  ...HTML when field value changes
[/WM-IndexLabel]

Examples
[WM-Record]
  [WM-IndexLabel: State]
   <tr>
     <td><h2>[WM-Field: State nolink]</h2></td>
     <td></td>
   </tr>
  [/WM-IndexLabel]
   <tr>
     <td width="80">[WM-FIELD: Code nolink]</td>
     <td>[WM-FIELD: Name]</td>
     </tr>
[/WM-Record]

Description
This tag is used only on index pages.

The [WM-IndexLabel] tag lets you write a portion of an index page only when the value in the specified field changes between records. This is especially useful for labelling groups of records on the page.

The [WM-IndexLabel] tag is used between [WM-Record] tags and is processed for each record in your source file. Any HTML between the [WM-IndexLabel] and [/WM-IndexLabel] tags is included if the data in the specified field has changed since the last record processed, or if the record being processed is the first one on the index page. If neither of these conditions is met, nothing is written in place of those tags. The HTML between the tags can include other WebMerge tags, as shown in the example above.

NOTE: If you're using WM-IndexLabel in conjunction with WM-Record, you'll probably want to put WM-IndexLabel before the WM-Record tag. This is because WM-Record will process every record in the source file, but WM-IndexLabel will only process records when the value in the specified field changes. This is especially important when using the multi-column option for WM-Record, as it will create a new cell for each record but WM-IndexLabel will tell WebMerge not to write anything into a cell unless the value in its field changes, giving you blank cells on your index page.

Introduced in WebMerge 2.1.