web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to handle empty re...
Power Apps
Answered

How to handle empty response?

(0) ShareShare
ReportReport
Posted on by 8

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

image.jpg
Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    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:

    vbofengmsft_0-1643001755742.png

    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

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard