|
Creates a reference from one variable to another, such that changes to one will appear to be made to the other. It can be also used to refer to a variable named created with an expression, like the miva_variable_value() function.
Attributes
NOTE: * INDEX and MEMBER refer to the variable in the NAME parameter, NOT the VARIABLE parameter. ExamplesIn its simplest form on variable can be directly referenced by another name. Example:<MvREFERENCE NAME = "g.global" VARIABLE = "l.local"> 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 a reference to an array record assign to item. Example:<MvASSIGN NAME="l.posn" VALUE="{ 1 }"> <MvREFERENCE NAME = "l.prod" VARIABLE = "{ 'l.products[' $ l.posn $ ']' }"> 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 }"> <MvREFERENCE NAME = "l.prod" VARIABLE = "{ 'l.products[' $ l.posn $ ']' }"> 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>
|