cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yjamous
Advocate II
Advocate II

How to check empty output from Select Action

Hi

I've a SharePoint List where it contains items.

I used the Get Items in order to pull some data from my SharePoint list and I use OData Filter to select specific records.

After that, I use Select in order to select specific items from the output in the previous step.

 

Now, I wish to put a condition that will check whether the output is empty or not.

My flow is below

 

 

yjamous_0-1628802603839.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
poweractivate
Community Champion
Community Champion

@yjamous 

Try one of these two ways. Assuming an array of interest is inside 'Compose 2' (but you can easily just use the body or body/value output of Get items instead in these expressions - whichever is appropriate for your case):

 

 

 

empty(outputs('Compose_2'))

is equal to

true

 

81221-emptrue.png

 

 

or

 

 

length(outputs('Compose_2'))

 

is less than 1

81221-len.png

 

Replace the example of outputs('Compose_2') in the above with the output of Get Items. This would be something like either outputs('Get_Items')?['body'] or outputs('Get_Items')?['body/value'] - use what works correctly here for your use case.

View solution in original post

4 REPLIES 4
happyume
Solution Sage
Solution Sage

Select action will give you an array.

You can use expression length(ARRAY)  to get number of elements in an array.

 

So in this case, use condition length(ARRAY) is equal to 0.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

poweractivate
Community Champion
Community Champion

@yjamous 

Try one of these two ways. Assuming an array of interest is inside 'Compose 2' (but you can easily just use the body or body/value output of Get items instead in these expressions - whichever is appropriate for your case):

 

 

 

empty(outputs('Compose_2'))

is equal to

true

 

81221-emptrue.png

 

 

or

 

 

length(outputs('Compose_2'))

 

is less than 1

81221-len.png

 

Replace the example of outputs('Compose_2') in the above with the output of Get Items. This would be something like either outputs('Get_Items')?['body'] or outputs('Get_Items')?['body/value'] - use what works correctly here for your use case.

View solution in original post

How can I find the name of the array that results from "Get Items" action?

 


@yjamous wrote:

How can I find the name of the array that results from "Get Items" action?


outputs('Get_items')?['body/value'] 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,033)