The CREATE_STRUCT function creates a structure given pairs of tag names and values. CREATE_STRUCT can also be used to concatenate structures.

Calling Sequence

Result = CREATE_STRUCT( Tags , Values )



The structure tag names. Tag names may be specified either as scalar strings or string arrays. If scalar strings are specified, values alternate with tag names. If a string array is provided, values must still be specified individually. Tag names must be enclosed in quotes.


The value of each field of the structure must be provided.



Use this keyword to create a named structure using the specified string as the structure name.


To create the anonymous structure { A: 1, B: `xxx'} in the variable P , enter:

p = CREATE_STRUCT('A', 1, 'B', 'xxx')

To add the fields "FIRST" and "LAST" to the structure, enter the following:

p = CREATE_STRUCT('FIRST', 0, p, 'LAST', 3)

The resulting structure contains { FIRST: 0, A: 1, B: 'xxx', LAST: 3}.

Finally, the statement:

p = CREATE_STRUCT(name='list', ['A','B','C'], 1, 2, 3)

creates the structure { LIST, A: 1, B: 2, C: 3}.

See Also

N_TAGS , TAG_NAMES , Creating and Defining Structures .