|
Creates a reference from one array to another, such that changes to one will appear to be made to the other
Attributes
NOTE: <MvDIMENSION> and <MvMEMBER> refer to the VARIABLE parameter, NOT the NAME parameter.
ExamplesIn its simplest form one array can be directly referenced by another name. This example makes a local array available globally. Example:<MvREFERENCEARRAY NAME = "g.global_array" VARIABLE = "l.local_array"></MvREFERENCEARRAY> In typical usage a sub member of a structure or array can be referenced simplifying programming syntax. For this example assume an array of data like this. l.products[1]:id = 27 A string expression creates an reference to an products array record assign to prod. Example:<MvASSIGN NAME="l.posn " VALUE="{ 1 }"> <MvREFERENCEARRAY NAME = "l.prod" VARIABLE = "l.products"> <MvDIMENSION INDEX = "{ l.posn }"> </MvREFERENCEARRAY> The variable l.prod now contains a reference to the array index such that l.prod:code is the same as l.products[1]:code. Using this in a loop results in clearer code. Example:<MvASSIGN NAME = "l.posn" VALUE = 1> <MvASSIGN NAME = "l.last " VALUE = "{ miva_array_max(l.products)}"> <MvWHILE EXPR = "{ l.posn LE l.last }"> <MvREFERENCEARRAY NAME = "l.prod" VARIABLE = "l.products"> <MvDIMENSION INDEX = "{ l.posn }"> </MvREFERENCEARRAY> ID: <MvEVAL EXPR = "{ l.prod:id }"><br> Code: <MvEVAL EXPR = "{ l.prod:code }"><br> Name : <MvEVAL EXPR = "{ l.prod:name }"><br> <MvASSIGN NAME = "l.posn " VALUE = "{ l.posn + 1 }"> </MvWHILE>
|