Hi Expert,
I have made a expression rule which is returning datasubset .
For eg: This is my query entity returning data.
Col A Col B Countcolumn
a b 2
d e 3
g h 1
Now i want to repeat row based on count column.How can i achieve following output:
Col A Col B
a b
d e
g h
Please help.
Discussion posts and replies are publicly visible
Two nested foreach loop should do that. The outer one on the rows, and the inner one on that count column.
Like Stefan mentioned, nested forEach will do the trick
a!localVariables( local!data: { { col1: "A", col2: "B", count: 4 }, { col1: "C", col2: "D", count: 2 } }, a!flatten( a!forEach( items: local!data, expression: a!localVariables( local!col1: fv!item.col1, local!col2: fv!item.col2, local!count: fv!item.count, a!forEach( items: enumerate(local!count), expression: { col1: local!col1, col2: local!col2 } ) ) ) ) )
Thanks Stefan.
Thanks sanchit.