I am building a template to create a report from an internal data source generated by our application. The data source is a list of plants containing a list of processes, with a value for each process, and I would like to generate a table with the following columns, ordered by value:
Plant name | Process name | Value
However, as it is a list of lists, I cannot simply use OrderBy. I first need to flatten the list (sadly I have no control over the data source).
It is feasible with SelectMany, but then I just have a flat list of processes, I no longer have the plant names, so I managed to list and order my values but without the necessary context.
I know that in “real .Net”, it is possible to define a function describing the object we want to generate, as shown in Enumerable.SelectMany Method (System.Linq) | Microsoft Learn, something like:
.SelectMany(petOwner => petOwner.Pets, (petOwner, petName) => new { petOwner, petName })
However, when I tried this syntax in a report template, it failed with Error! Can not resolve method 'SelectMany' on type 'tl'.. Does it mean it is not supported or did I mess it up somewhere?
Here is a minimal program with a simple JSON data source I used to test:
testSelectManyReportingEngine.zip (106.7 KB)
Thanks in advanced!