Table of contents

Official Content

When defining a variable, regardless of the context, once its data type has been established, you can choose to define it as a collection rather than as a single value 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 access the individual items in the collection, you must define a simple variable of the collection item's data type and use the For in command to run through the collection.

For &var IN &collectionVar
   ...
EndFor

What data type can items have?

Any data type can be used. In particular, in addition to basic data types (numeric, character, etc.) and extended data types (such as HttpRequest), it can be an SDT type (either simple or collection), or a BC.

It's worth mentioning that once a variable is defined as a collection, the Dimensions property is automatically set to 'Scalar'. In other words, variables that are collections of arrays or matrices cannot be defined.

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: 2026 | © GeneXus. All rights reserved. GeneXus Powered by Globant