Programming Guide : 6. Working with Arrays, Table Fields, and Collections : Arrays : How You Can Reference an Array
 
Share this page                  
How You Can Reference an Array
OpenROAD provides syntax for referencing each of the following array components:
An array as a single entity
Individual array rows
A member of a nested structure
Individual columnfields if the array is associated with a table field of the same name
Individual data items in a row
The syntax for each of these references is summarized in the following table:
Array Component
Reference Syntax and Example
Array
arrayname
Example:
callproc update_db(vid_cust=custtable);
Row
arrayname[n]
Example:
callproc update_acct(account =
custtable[2]);
Nested Object's Attribute
arrayname[n].nestedobject.attribute
Example:
custtable[5].address.custcity = 'Daly City';
Nested Array's Attribute
arrayname[n].nestedarray[m].attribute
Example:
custtable[4].vid_rent[5].title = Kismet';
Column field
arrayname[*].attribute
Example:
on childexit custtable[*].acctbalance
This syntax is usable only if custtable is a table field.
Individual attribute
arrayname[n].attribute
Example:
custtable[3].custzip = zip;
This syntax refers to an individual attribute. If we had tablefield[n]. attribute, it would refer to an individual table field cell.
To refer to elements of an array underlying a dynamically created table field, use a dynamic expression (DynExpr). For more information about creating a table field dynamically, Creating Dynamic Frames.
References to nested arrays and objects proceed left to right from the general (outermost array row) to the specific (innermost array, row, or data item). For example, the order of precedence for the following reference:
custtable[4].vid_rent[5].title
is:
1. Row 4 in the custtable array
2. The attribute vid_rent (itself an array) in row 4
3. Row 5 of the vid_rent array
4. The attribute title (of the vid_rent array)
You cannot change the order of precedence in nested syntax.