Well for the sake of argument I've whipped you up a quick example using a probably-oversimplified local data structure, but which might at least help you solidify the necessary "skeleton" of the thing you're trying to build...
a!localVariables(
local!nestedDataSet: {
a!map(
name: "Set 1",
contents: {
a!map(
itemName: "item a1",
features: {
a!map(featureName: "feature q1", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature q2", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature q3", widgetCount: tointeger(rand()*20)),
}
),
a!map(
itemName: "item a2",
features: {
a!map(featureName: "feature w1", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature w2", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature w3", widgetCount: tointeger(rand()*20)),
}
),
a!map(
itemName: "item a3",
features: {
a!map(featureName: "feature e1", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature e2", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature e3", widgetCount: tointeger(rand()*20)),
}
)
}
),
a!map(
name: "Set 2",
contents: {
a!map(
itemName: "item b1",
features: {
a!map(featureName: "feature r1", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature r2", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature r3", widgetCount: tointeger(rand()*20)),
}
),
a!map(
itemName: "item b2",
features: {
a!map(featureName: "feature t1", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature t2", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature t3", widgetCount: tointeger(rand()*20)),
}
),
a!map(
itemName: "item b3",
features: {
a!map(featureName: "feature y1", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature y2", widgetCount: tointeger(rand()*20)),
a!map(featureName: "feature y3", widgetCount: tointeger(rand()*20)),
}
)
}
),
},
a!sectionLayout(
contents: {
a!gridLayout(
headerCells: {
a!gridLayoutHeaderCell(label: "Name"),
a!gridLayoutHeaderCell(label: "Quantity")
},
rows: a!forEach(
local!nestedDataSet,
a!localVariables(
local!currentLevel1: fv!item,
local!isCurrentLevelExpanded: false(),
{
a!gridRowLayout(
contents: {
a!richTextDisplayField(
value: a!richTextItem(
text: fv!item.name,
link: a!dynamicLink(
saveInto: a!save(local!isCurrentLevelExpanded, not(local!isCurrentLevelExpanded))
),
linkStyle: "STANDALONE"
)
),
a!richTextDisplayField(value: "Items: " & length(fv!item.contents))
}
),
if(
local!isCurrentLevelExpanded,
a!forEach(
local!currentLevel1.contents,
a!localVariables(
local!currentLevel2: fv!item,
local!isCurrentChildLevelExpanded: false(),
{
a!gridRowLayout(
contents: {
a!richTextDisplayField(
value: {
" - ",
a!richTextItem(
text: fv!item.itemName,
link: a!dynamicLink(
saveInto: a!save(local!isCurrentChildLevelExpanded, not(local!isCurrentChildLevelExpanded))
)
)
}
),
a!richTextDisplayField(
value: a!richTextItem(
text: " Features: " & length(fv!item.features),
style: "EMPHASIS"
)
)
}
),
if(
local!isCurrentChildLevelExpanded,
a!forEach(
local!currentLevel2.features,
a!gridRowLayout(
contents: {
a!richTextDisplayField(
value: {
" - - ",
a!richTextItem(
text: fv!item.featureName,
size: "SMALL"
)
}
),
a!richTextDisplayField(
value: a!richTextItem(
text: " Widget Count: " & fv!item.widgetCount,
size: "SMALL"
)
)
}
)
),
{}
)
}
)
),
{}
)
}
)
)
)
}
)
)
