cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tedmalone
Level: Power Up

Problems testing for empty result from Excel - List Rows present

I am trying to write a simple flow which looks to see if a row containing a key item exists, and if not I will add a new row.

 

I wrote an Odata filter in List Rows Present to search on the incoming key data. If the key value is not found, I get an empty body from List Rows Present. I have tried creating a Condition to test for Null in tons of ways:

equals(triggerbody(), null) = true

trigger() = null

triggerFormDataValue('value') = null

and *many* other variations. 

 

Any suggestions would be greatly appreciated!

 

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Problems testing for empty result from Excel - List Rows present

 

Hi @tedmalone ,

 

If it is an array, you can also use length() to determine the number of array elements. The current Body returns an empty array, so we can use the method I provided directly.

10.PNG11.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Problems testing for empty result from Excel - List Rows present

 

Hi @tedmalone ,

 

You could use length() function to get numbers of the filtered rows.

Expression reference:

length(body('List_rows_present_in_a_table')?['value'])

Image reference:

115.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tedmalone
Level: Power Up

Re: Problems testing for empty result from Excel - List Rows present

Thank you, this was very close! Because length() wanted a string, I used the following:

 

length(string(body('List_rows_present_in_a_table')?['value']))
 
And, since Body contained "value: []" the returned length was 2, presumably for the square brackets.
So, I modified the Condition to compare the above length string equal to 2 and it works!
Community Support Team
Community Support Team

Re: Problems testing for empty result from Excel - List Rows present

 

Hi @tedmalone ,

 

If it is an array, you can also use length() to determine the number of array elements. The current Body returns an empty array, so we can use the method I provided directly.

10.PNG11.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,584)