When you want to return arrays from a flow in Power Automate to an app in Power Apps you could use the Response action, however this requires a premium connector
First of all if your flow really uses premium features then just get that premium licence in place, but if you don’t use any other premium features then you might want to use the method described in this post to avoid the costs of a premium licence.
In my case my client wanted to display documents in a a document library and enable the management of document versions inside an app.
So I started by creating a flow that asks for the ID of a document and then all the versions are returned by the REST API call following.
The above returns potentially a lot of data that we want to send to the app.
The data that we get returned will need to be reshaped using the apply to each with a compose action side. Simply create a list of fields returned by the Apply to each and separate them by something that you would never find in the data. I’m using ### in this case.
Now we just need to return this to the app:
join(outputs('Compose'),'##Version##')
This will now give us an array of data where each item is separated by ##Version## and each field is separated by ###
Now within the app we can create a gallery that has the following items code:
colVersionHistory
And use some code to set this collection using the following one liner
ClearCollect(colVersionHistory, Split(Getversionsofdocuments.Run(ThisItem.ID).result,”##Version##”).Result);
Then for each field we want to display inside the gallery
Index(Split(ThisItem.Result,"###").Result,1).Result
The above will get the first field. To get the second field simply replace the 1 with a 2 and so on.
And that is it. An easy way to send arrays of data back to your app.
Continue Reading Pieter Veenstra’s Article on their blog
Return Arrays from Power Automate to Power Apps without a premium licence
When you want to return arrays from a flow in Power Automate to an app in Power Apps you could use the Response action, however this requires a premium
Blog Syndicated with Pieter Veenstra’s Permission