Condition Elements
  • 23 Aug 2024
  • 2 Minutes to read
  • Dark
    Light

Condition Elements

  • Dark
    Light

Article summary

General

Condition elements can be used to exclude certain rows of a Template based on a condition.

Properties

This type of report element has the following properties:

Name

Description
NameThe name of the condition element. This name will be displayed in the tree hierarchy of the content explorer of the Report Designer.
CodeThe code of the condition element. There must be no other report element within the same report with the same code. The code is used to reference the report element from within a Template (see below).
ConditionAn optional condition Expression; if it returns True or 1 the condition is considered to be fulfilled and the portion encapsulated by the condition element will be included in the report document. If it returns something other than True or 1 the portion encapsulated by the condition report element will be excluded. If you leave this property empty, the condition is considered to be always fulfilled. The condition expression is evaluated after the preparation Actions of the image element have been executed.
Preparation ActionsA list of Actions that will be executed before the condition element will be processed.
Fail On Filter ExceptionDetermines what shall happen if an exception occurs when executing a preparation action that performs a filter (e.g. because the value to which you want to filter does not exist). When enabled, an exception will be thrown and the report document creation will be cancelled; when disabled, the portion encapsulated by the condition report element will be excluded.

Insertion

You can insert a condition element into the template by dragging and dropping it into the content editor. A start and an end tag with the following syntax will be added:

Condition Element Start tag

[[<code>]]

Condition Element End tag

[[<code>]]

Every row between the start and end tag will be excluded from the template if the condition is not fulfilled. The rows containing the start and the end tag will be removed from the output in all cases.

NOTE

If you change the code of a table element after you have inserted the placeholder into the template, you need to edit the start and end tag in the template as well. Otherwise error messages will occur when creating the report document.

Example

The following screenshot shows a template where the header in the first row will always be included in the output; the table element MyTableElement will only be included in the output if the condition MyConditionElement is fulfilled:


Condition Element Example


Was this article helpful?

What's Next