Official Content

To return a new initialized instance of a Structured Data Type (SDT) variable.

Syntax

&Var = New SDTName()

or

&Var = New()  //if rename the SDT, you don't need to change the source.

Where:

&Var
   It’s a variable based on SDT.

SDTName()
   It’s the name of a collection SDT or item (regardless of the variable data type).

The operator should be used when adding elements to an SDT collection.

Note

It is possible to include an SDN Name from the Insert/SDT option (or with ctrl. + Space). 

Sample

For each 
    &A.CliName = CliName
    &A.CliAdd = CliAdd
    &ClientList.Add(&A)
    &A = New Client() 
EndFor

The first new is implicit when defining a variable.  It is not necessary to use the command at the beginning of the for each.

Scope

Objects Structured Data Type (SDT) object
Languages .NET, Java, Ruby, Visual FoxPro

See Also

Clone Method

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