Reputation: 1721
I have a power app that wants to collect some data from a rest API, I am using Flow as this seems to be the recommended way.
I have a collection:
[
{id: 1,name: "test",lines: [
{id: 244,
StrategyId: 1,
TypeId: 0,
Weight: 10,
toWeight: 200
}
]
},
{id: 3,name: "test2",lines: [
{id: 262,
StrategyId: 3,
TypeId: 0,
Weight: 0,
toWeight: 200
}
]
}
]
When I enter this into a formula straight up, it works fine:
ClearCollect( CityPopulations, json...)
However, when I try to fetch the data from Flow it only returns a collection with one single entry that is the json data as string.
Set('CityPopulations','PowerApp->Sendmeamobilenotification'.Run());ClearCollect(NewTable, CityPopulations.testoutput);
In Microsoft flow I use PowerApps trigger and Respond to PowerApps.
Also note that there are no " on the propertynames in json structure, but this was the only way I could get Power Apps to actually accept typing in json manually. I have tried having the respons propper, as well as this way. I had to adjust the flow to remove the " around propertynames. Still same result.
This is how the table looks in collections:
This is how it looks when I am entering the data manually:
this is the direct output from :
{
"testoutput": "[{id:1,name:\"test\",lines:[{id:244,StrategyId:1,TypeId:0,fromWeight:10,toWeight:200}]},{id:2,name:\"tester\",lines:[{id:154,StrategyId:2,TypeId:0,fromWeight:10,toWeight:200}]}]"
}
The biggest difference is the escape characters added from flow.
Upvotes: 0
Views: 6469
Reputation: 31
This took me quite some time to solve so maybe will help others.
When you want to return an array (collection) form Flow to a Canvas App you need to use Response (Request), not Respond to PowerApps.
All the problems go away with that
Tip: Remember to provide a SCHEMA and to remove and re-add the flow in the canvas app
Upvotes: 3
Reputation: 4365
It looks like your Collecting a single column of Text from the API Response rather than collecting the entire response.
Try just using:
ClearCollect(colNewTable,'PowerApp->Sendmeamobilenotification'.Run())
If you want to set colNewTable
as a variable, wrap it like:
Set(varNewTable,ClearCollect(colNewTable,'PowerApp->Sendmeamobilenotification'.Run())
Hope this helps!
Upvotes: 0