Xbasic
Merge_Variable_Frames Function
Syntax
V merge_variable_frames(P dominantFrame ,P otherFrame )
Arguments
- dominantFrame
A dot variable containing one or more sub-variables. If the otherFrame contains a variable of the same name, the variable value from the dominantFrame is used.
- otherFrame
A dot variable containing one or more sub-variables.
Description
Merges the variables from one variable frame into another variable frame.
Discussion
Merges the variables in two different variable frames (i.e. 'dot' variables) into a single variable frame.
Example
'Assume that you have two dot variables (v1, and v2) defined as follows: dim v1 as p v1.name = "John" dim v1.cities1 as c v1.age = 23 dim v1.arr3 as p v1.arr1.item1 = "Row1 - item1" v1.arr1.item2 = "Row1 - item2" dim v2 as p v2.name = "Harry" v2.occupation = "Lawyer" dim v2.cities3 as c v2.cities1 = "Boston" v2.cities2 = "New York" v2.cities3 = "Chicago" 'Now merge these dot variables, with V2 as the 'dominant' frame merge_variable_frames(v2,v1) 'Now use the *variable_to_script() function to see what the resulting variable frame looks like: ?variable_to_script(v2) DIM age as N = 23 DIM arr3 as P DIM arr1.item1 as C = "Row1 - item1" DIM arr1.item2 as C = "Row1 - item2" DIM name as C = "Harry" DIM occupation as C = "Lawyer" DIM cities3 as C cities1 = "Boston" cities2 = "New York" cities3 = "Chicago"