## Multiple

Templating System : Designer Guide : Tag Reference : Multiple

### Summary

The `multiple` tag is used to repeat a template section for each row of a multirow data source. Column variables are reset with each repetition to the values of the next row of the data source.

### Usage

    <!-- Begin multiple layout, i.e. <table> -->
    <table>

    <multiple name="users">

      <!-- Row layout, i.e. <tr>...</tr> -->
      <tr>

        <td>
         @users.first_name@
        </td>

        <td>
          @users.last_name@
        </td>

        <td>
          @users.state@
        </td>

      </tr>

    </multiple>

    <!-- End multiple layout, i.e. </table> -->
    </table>

### Notes

- The special variable `datasource:rowcount` may be used to check for no rows in a data source (or any other special condition related to the number of rows in the data source).

- The special column `datasource.rownum` is set implicitly for each repetition and can be used in conjunction with the `if` tag to do row banding:

        <multiple>

        <if @datasource.rownum@ odd>
          <tr bgcolor="#eeeeee">
        </if>

        <if @datasource.rownum@ even>
          <tr bgcolor="#ffffff">
        </if>

        ...

- The `maxrows` attribute may be used to limit the number of rows that are output from the data source:

        <multiple maxrows="n">
        ...

  This attribute will cause processing to stop after n rows have been output.

- The `startrow` attribute may be used to skip a number of rows at the beginning of the data source:

        <multiple startrow="n">
        ...

  This attribute will cause processing of the data source to begin at row n + 1.

- [Note: Carsten added this feature during the Berlin Hackaton 2004-02-14]

  The `delimiter` attribute will add a string after each row except the last row:

        <multiple delimiter=" | ">
        ...

  This attribute will cause the rows to appear to be sepparated by vertical bars. This is much more convenient than using the `<if>` tags to check whether we are on the last row.

- The `startrow` and `maxrows` attributes may be used together to output any range from the data source.

- See the `group` tag for formatting subsets of a multirow data source. In the current implementation, the `<multiple>` tag does not nest.