cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
David59740
Helper II
Helper II

Select action for JSON fields values failing due to missing JSON objects

I am working on a flow where I input a receipt to a Form Recognizer API, then run a GET request to get the results of the receipt in JSON form. The fields that are returned are MerchantName, MerchantAddress, MerchantPhoneNumber,
Subtotal, Tip, Tax, Total, TransactionDate, and TransactionTime. I have a select action that goes into the JSON and retrieves each value (Example: item()['fields']['Tip']['valueNumber']. However not all receipts have all of these values. For instance if the receipt does not have a Tip category I get the error message: " 'item()['fields']['Tip']['valueNumber']' cannot be evaluated because property 'Tip' doesn't exist, available properties are 'MerchantAddress, MerchantName, ReceiptType, Subtotal, Total, TransactionDate, TransactionTime.'" The object does not appear at all in the JSON in these cases.
I have tried using the if(empty()) function on the object in the Select as well as if object = "", but I have failed time and time again. If anybody knows a workaround for this it would be much appreciated.

1 REPLY 1
luismarianoz
Microsoft
Microsoft

Hi @David59740 

 

Can you try to use condition like that 

 

luismarianoz_0-1654287333742.png

or in this way 

 

https://docs.microsoft.com/en-us/power-automate/use-expressions-in-conditions#use-the-empty-expressi...

 

 

Luis Zuñiga

Support Engineer

Microsoft Power Platform

If this post helps, then please consider accepting it as the solution to help other members find it more quickly! Have a great day!

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,272)