Table of contents



Official Content

 When defining a variable, in any context, once the data type is established, you have the choice to declare it as a collection - not as a simple variable of that data type:

 

Variable Properties Variable Editor

 

The default Collection property (IsCollection checkbox) value is 'False'. If you set it to 'True', you'll have a collection variable whose items are of the established data type.

To work with the individual items of the collection, you have to define a simple variable of the collection items data type, to run through the collection, using the 'For IN' command.

For &var IN &collectionVar
   ...
EndFor

What data type can items have?

Any. Particularly, in addition to the basic (numeric, character, etc.) and extended ones (HttpRequest), it can be an SDT type (simple as well as collection), or a BC one.

It's worth mentioning that once it has been established that the variable is a collection, the Dimensions property automatically takes the 'Scalar' value. In other words, variables that are collections of arrays or matrices cannot be defined.

You can see the particular case of  Implementing SDT collections.

Considerations

Collection variables associated with basic GeneXus data types (such as Numeric, Character, Date and so on) are not supported on the form; for those cases, you need to define a Structured Data Type (SDT) object.

See also

Collection Domains
SDT on Form





Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant