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 parts 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.

Condition Modes

You can use condition elements in two modes.

NOTE

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

Sheet Condition

When using a condition element in this mode, the sheet that contains the reference to the condition element will be removed from the workbook if the condition is not fulfilled. You can use a condition element as a sheet condition by placing a reference to the condition element (without any closing tag) in any cell of the sheet you want to the condition to apply to using the following syntax:

Condition Element Start Tag

[[<code>]]

Row Condition

When using a condition element as row condition, you have to place a start and an end tag of the condition element into the worksheet using the following syntax:

Condition Element Start Tag

[[<code>]]

Condition Element End Tag

[[<code>]]

Every row between these condition elements will be removed if the condition is not fulfilled.

NOTE

The rows that contain the start and end tags of the condition element will be removed from the worksheet regardless of whether the condition is fulfilled or not; you therefore have to place them into rows which contain no other content.


Condition Element Reference in Microsoft Excel Template


Was this article helpful?