Here is the use case Name1 is the section names value1 is the text value,when next section name starts with item2 before empty section names consider as section names with the text followed by as mentioned in the output
a!localVariables( local!testdata: { { "Name1": "Item1", "Value1": "Data for Item 1" }, { "Name1": null, "Value1": "Different data for Item 2" }, { "Name1": null, "Value1": "Some other kind of data" }, { "Name1": "Item2", "Value1": "Another example of data" }, { "Name1": null, "Value1": "Random data like GBP 50,000" }, { "Name1": "Item3", "Value1": "Data related to an event or value" }, { "Name1": null, "Value1": "Adjustable by percentage of revenue" }, { "Name1": null, "Value1": "Premium payable quarterly" } }, local!testdata
Discussion posts and replies are publicly visible
OK, then here is my solution. There are very simple alternatives to foreach(),
This helper expression either updates the last item in the list and concatenates the text, or adds a new section item. The created value is then passed to the next iteration by the reduce() function.