Conditional Rows

Category : Technical Examples

Conditional Rows allow table rows to be included or removed from the final document.

Multiple rows can be filtered out based on conditions in the supplied data.


Template
Data Files
Output Files
All Files as a ZIP

This example explained

1) How Conditional Rows are defined.

In a table row, add a conditional row field:
      <<cr_book1>>
which marks the beginning of a set of rows to be optionally filtered out.  The end marker is placed in a row further down the table:
      <<er_book1>>
If the data value "book1" is true, all rows between the <<cr_book1>> row and the <<er_book1>> row will be included.  The rows containing the <<cr_>> and <<er_>> are always removed.

TRY: setting the book1 data to false.

 

2) Conditional Rows can be within Repeating Rows

There is no limitation to using conditional rows within tables. 
Conditional rows can control a single row or multiple rows and can be nested within other conditional rows or repeating rows.
As the <<cr_inStock>> conditional row is included within <<rr_newspapers>>, the conditional row will be tested for each data item in "newspapers", and each that have "inStock" equal to true will be included.

 

3) Conditional Rows and Expressions

Expressions may be used in the conditional field in order to test more complex conditions.
They are included in braces and cause the rows between to be included if true.
The rows in between the <<cr_{description!=null&&description!=''}>> conditional are included only when "description" is in the data of a particular item in "newspapers", and is not blank.

In a table row, add a conditional row field:
  <<cr_{address!=null}>>
which marks the beginning of a set of rows to be optionally filtered out.  The end marker is placed in a row further down the table:
  <<er_{address!=null}>>
If the data value "address" is not blank, all rows between the <<cr_{address!=null}>> row and the <<er_{address!=null}>> row will be included.  The rows containing the <<cr_>> and <<er_>> are always removed.


LEARN MORE: Download our Docmosis Quick Reference [PDF].