Add method

Official Content
This documentation is valid for:

To add an item to a collection.

Syntax

Add( Item [ , Position ] )

Where:
Item
    Variable based on SDT.
Position
    Relative position.

Description

It Adds Item to the collection relative position: Position.
If Position is omitted, or if “0” is specified, the Item is added at the end of the collection. Position starts at 1.

For each element to be added to a collection, previously it is necessary to create a memory space by using the new operator. For example:

for &i = 1 to 1000
  &item = new()
  &item.SomeMember = "SomeValue"
  &sdtCollection.Add(&item)
endfor


Scope

Objects Procedure object, Transaction object, Web Panel object
Languages .NET, Java, Ruby (up to GeneXus X Evolution 3)
   

See also

Structured Data Type Methods


Note

The same method can also be used to add a new item to a list of Java Scripts (in Transactions and Web Panels), like shown: Control.Add(Item)
More details: Access to a Web Object's Header