Collection variables in K2BTools

K2BTools supports defining collection variables in pattern instances. To define a variable as a collection, use the "Is Collection" property.

Variables defined as collections must contain a control info node to define its appearance when shown un the UI.

Only some control types support collection variables. Some of the controls that support collection variables are the Dynamic Combo Box, Suggest, Image Region Selector, and Toggle control types.

When used to edit collections, these control types will change to support this, and new properties may appear in the control info node to configure the behaviour when editing collections. See the control type's documentation to see if collections are supported and which properties are added in that case.

Referencing collection variables in events

GeneXus does not support adding collection variables to the web form directly. To implement this feature K2BTools includes a user control and associates the variable's value with that user control.

This implies that the UI properties of the variable must be set through the user control and not through the variable itself. To simplify this as much as possible, K2BTools generates the user control with its control name set to the variable name.

In practice, this means that to set a UI property the developer must not include the "&" sign before the variable name.

For example, to disable a common variable the developer would include this code:

&Variable.Enabled = False

To enable a collection variable the developer must include this code instead:

Variable.Enabled = False

Warning: The UI properties affect how the variable is shown (or hidden), but they do not affect how they are processed. Beware when using this properties of not relying on them to prevent modifications in the variable. If a variable should not be modifiable, the developer should verify that the value did not change before processing the user input.