Logic Components do not have a direct visual representation on the screen. Instead, they modify the Screen structure. In contrast to other Screen Components, Logic Components may also be placed where other components are forbidden, e.g.
between a Table and its child Row Component. This way, it is possible to create tables with a dynamic number of rows or with columns displayed or retained based on dynamic conditions.
Logic Screen Components are:
By using the For component, you can create several copies of the contained components. The contained components can see the 'number' of their copies. Each new copy created is a new 'iteration' of the For component.
Properties tab:
- Variable – Name of the variable used to store the 'number' of the current iteration. The contained components can access the iteration number using this variable.
- Start – Number of the first iteration.
- End – Number of the last iteration. If the Variable exceeds this number, the For component stops iterating.
- Increment – Number added to the Variable after each iteration.
- Iteration Counter (optional) - Variable indicating the current loop index. It is set to 1 for the first iteration and then automatically incremented by one for every iteration. This variable is of type Integer and is only available for child components.
- Iteration Id - Expression used to calculate a unique Id for each iteration.
Similarly to the For component, the For Each Screen Component creates several copies of the contained components. Unlike For, however, For Each does not use Start and End numbers. Instead, it creates a copy of the components for each element in a Collection - thus the name 'For Each'.
Properties tab:
- Variable – Name of the variable used to store the current element from the collection through which the For Each component iterates. The contained components can access the collection element through this variable.
- Variable Type – Collection Element type
- Variable Collection Type –Indicates whether the collection is a Named collection, an Indexed collection or a Single Element (thus, not a collection).
- Collection – Expression returning the collection used to iterate through.
- Iteration Counter (optional) - Variable indicating the current loop index. It is set to 1 for the first iteration and then automatically incremented by one for every iteration. This variable is of type Integer and is only available for child components.
- Iteration Id - Expression used to calculate a unique Id for each iteration.
The For Each component maintains an implicit variable $index that can be used to access the iteration number. The count starts at 1 and is incremented for every iteration step.
Like the For and For Each components, the While Screen Component is used to create copies of contained components. Copies are created while the Condition Expression of the While component evaluates to true.
Properties tab:
- Condition – While this condition evaluates to true , the While Component creates copies of the components contained within it.
If the condition is evaluated to false from the first iteration, no copies of the components are created.
- Iteration Counter (optional) - Variable indicating the current loop index. It is set to 1 for the first iteration and then automatically incremented by one for every iteration. This variable is of type Integer and is only available for child components.
- Iteration Id - Expression used to calculate a unique Id for each iteration.
The While component maintains an implicit variable $index that can be used to access the iteration number. The count starts at 1 and is incremented for every iteration step.
You can use the If component if there are parts of the Screen you only want to show in certain cases. Drag these components into an If element and set the Condition for the components to be shown.
Properties tab:
- Condition – Expression indicating whether the components contained in the If component should be shown.
- If it evaluates to to
true, the components are shown. - If it evaluates to to
false, the components are hidden.
For suggestions on when to use the If component to hide parts of the screen, see the Group Hidden vs. If Condition recipe.
Else If
The Else If Screen Component can be added to a Screen only after an If or another Else If component.
When the condition set in the If evaluates to false, then the condition in the Else If is evaluated. If such a condition evaluates to true, the content of the Else If is shown on the Screen.
Else
The Else Screen Component can only be used in combination with an If or an Else If component.
The content of the Else component is shown when the condition of the preceding If gets evaluated, and is evaluated to false.
The Case Screen Component can only be added within a Switch component. The Switch component evaluates an expression, while each Case component contains a value. The expression in the Switch component is compared to each Case, and the one matching is the one whose content is shown.
The Case/Switch combination works like a chain of If component, but it makes it easier to choose what to show based on an expression.
Example:
Switch ($myFavoriteColor)
Case 'red' shows a red screen
Case 'blue' shows a blue screen
Case 'green' shows a green screen
The Phase Control Screen Component allows you to improve screen performance.
The Phase Control acts as a container for other Screen Components (children) and allows you to configure the conditions under which you execute or skip the Update, Validate, or Process phases for the child components.
For information on this component, see the Screen Component: Phase Control article.