I was wondering if there is a simpler way to get Multidimensional Arrays to work with Form Screen Arrays for Displays/Inputs
I have a Global Multidimensional Array set up like this
tier01 dynamic array of record
t01_id integer,
t01_code varchar(10),
tier02 dynamic array of record
t02_id integer,
t02_code varchar(10)
end record
end record
Which is just holding Dummy Data for Testing like this
let tier01[1].t01_id = 1
let tier01[1].t01_code = "T1-1"
let tier01[1].tier02[1].t02_id = 1
let tier01[1].tier02[1].t02_code = "T1-1 T2-1"
let tier01[1].tier02[2].t02_id = 2
let tier01[1].tier02[2].t02_code = "T1-1 T2-2"
let tier01[2].t01_id = 2
let tier01[2].t01_code = "T1-2"
let tier01[2].tier02[1].t02_id = 3
let tier01[2].tier02[1].t02_code = "T1-2 T2-3"
let tier01[2].tier02[2].t02_id = 4
let tier01[2].tier02[2].t02_code = "T1-2 T2-4"
let tier01[2].tier02[3].t02_id = 5
let tier01[2].tier02[3].t02_code = "T1-2 T2-5"
let tier01[3].t01_id = 3
let tier01[3].t01_code = "T1-3"
let tier01[3].tier02[1].t02_id = 6
let tier01[3].tier02[1].t02_code = "T1-3 T2-6"
And am wanting to display it to a very basic Form
layout(windowStyle="standard")
vbox
group(text="Tier 01")
table(height=1 lines)
{
[t01a ][t01b ]
}
end
end
group(text="Tier 02")
table(height=1 lines)
{
[t02a ][t02b ]
}
end
end
end
end
attributes
edit t01a = formonly.t01_id, title=%"ID";
edit t01b = formonly.t01_code, title=%"Code";
edit t02a = formonly.t02_id, title=%"ID";
edit t02b = formonly.t02_code, title=%"Code";
instructions delimiters " "
screen record screen_tier01(t01_id, t01_code)
screen record screen_tier02(t02_id, t02_code)
end
The Phantom Fields don't seem to work for Array Fields so I had to create duplicate Global Flat Arrays to get the display working
# work around for displaying only
tier01_flat dynamic array of record
t01_id integer,
t01_code varchar(10)
end record,
# work around for displaying only
tier02_flat dynamic array of record
t02_id integer,
t02_code varchar(10)
end record
Then I can use the Display Array as normal
dialog d_display_tier01()
display array tier01_flat
to screen_tier01.*
end display
end dialog
dialog d_display_tier02()
display array tier02_flat
to screen_tier02.*
end display
end dialog
Then I am just copying the data from the Multidimensional Array into each respective Flat Array so it can be applied to the displays.
I'm just wondering if there is a better way to do this that doesn't need the creation of the Flat Arrays so I can stick with a single Multidimensional Array.