I'm creating a lookup context table of tables that will allow me to set choice lists for forms on the fly. The idea is to create an outcome like this:
{
TableName: Table1
TableValue: {
Record: {
DisplayColumn: Display1,
ValueColumn: Value1
},
Record: {
DisplayColumn: Display2,
ValueColumn: Value2
}
},
TableName: Table2...... Etc.
Here's the code I have:
ClearCollect(
colRequestChoiceContext,
ForAll(
Filter(
colRequestSummaryMerged,
lg_columntype = 'Column types'.Choice
),
{
TableName: RequestAlias & "_" & ThisRecord.lg_datafield,
TableValue: Switch(
ThisRecord.lg_lookupmethod,
'Choice Lookup Methods'.'Choice List',
ForAll(
Split(
lg_choicelist,
","
),
{
ColumnName: First(
Split(
Value,
":"
)
).Value,
ColumnValue: Last(
Split (
Value,
":"
)
).Value
}
)
)
}
)
);
I have several methods of looking up the option values, but I'm starting out with the simple explicit collection which I parse with a Split function.
I do get a table of TableName/TableValue with the value being a table. Trouble is each value table is itself a list of tables, which is not what I wanted. I'd like to be able to assign a dropdown items property with something like:
Filter(colRequestChoiceContext,TableName = RequestAlias & "_" & ThisItem.lg_datafield).TableValue
Instead, the records I want are in
First(Filter(colRequestChoiceContext,TableName = RequestAlias & "_" & ThisItem.lg_datafield).TableValue).TableValue
I suppose it's not the end of the world, but when I finish the Switch statement with other methods to gather this data, I'll need the formats to match. Any idea how I can get rid of this extra layer?
Thanks much!