Generating tables with dynamic size and dynamic values

Hi everyone,

My team wants to have a set of documents that generate based on sharepoint list dynamic content in ms flow. That amount of data points that we want to use from the list changes daily, but I would like to be able to write a single flow/code for this process. In essence what I want to be able to do is grab all the information from a list, filter for the data points that I want to see based off an input from a power app, then add this data to a docx template. This would be simple if it was ten points of data every time. The problem is that sometimes that filtered data could be three points and other times it could be 40 points.

Is there a way for me to accomplish this?

Thank you,
Alex

1 Like

Hello, @apearson.

To get specific data from the list you can use Get SharePoint Items By CAML Query action. Please see an example from here.
Also that example might help you create a DOCX using the json data retrieved from the previous step.

Best regards, Kirill Shaklein

Hi @kirill_sh,

I have tried working the CAML Query for this issue. I must not be writing it correctly because it still only yields the last entry.

Alex

Hello, @apearson.

There must be a loop initiated, when it rewrites the values coming from each item in the list.
CAML Query returns the following:
{
"countItems": some_number,
"items": [
{
"some_field": "some_value"
"some_field": "some_value"
},
...
]
}

So, in the Template Data Field you can simply use Items, retrieved from the CAML:

In the docx place tokens with corresponding names: {{ some field }}.

Best regards, Kirill Shaklein