Hi,
I’m having a problem with canvas application.
In my App, I have a filter panel, so user is able to filter everything what they want. Then ‘Search’ button invokes power automate flow, execute SQL stored procedure, and output data are send back to Power Apps - that it’s fine.
The output is displayed in a power apps gallery. Everything works fine as long as the returned result is not empty. It’s not an issue when output is empty, it just means that no records in sql were found for selected criteria.
Once the output is empty, Then the problem starts with my gallery and the fields that are referring or expecting always non-empty values.
As you can see on the attached window, there is a Red Cross icon next to my fields in a gallery, which display values that should come within output?
the question is how to handle empty responses in a gallery, and avoid showing it as an error or something??
the error message I got is: “MyFlow.Run failed: the data returned in the response is invalid. Response data should be a valid JSON object”
just to remind you, it happens only when the called procedure returns empty results.
When I Call a procedure with a data which exists in a database, then of course everything is fine with the output and the gallery which displays it.
Thanks
Solved! Go to Solution.
Hi @koperek7 :
The point is that an error occurs when the response's body is null. So you can first set a judgment condition, when the value of the target parameter is null, use an empty array instead . For example:
if(
equals(outputs('Compose_2'),null),
json('[]'),
outputs('Compose_2')
)
On your side , you could replace outputs('Compose_2') with the return value of 'executing the stored procedure' action.
Best Regards,
Bof
Hi @koperek7 :
The point is that an error occurs when the response's body is null. So you can first set a judgment condition, when the value of the target parameter is null, use an empty array instead . For example:
if(
equals(outputs('Compose_2'),null),
json('[]'),
outputs('Compose_2')
)
On your side , you could replace outputs('Compose_2') with the return value of 'executing the stored procedure' action.
Best Regards,
Bof