cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Check if filtered SharePoint list is empty

I am attempting to create a flow which after updating the end date of a member record, then rechecks the SharePoint list the record is stored in for duplicates of that members email (this would occur if a member were to simultaneously hold two positions in my organization.) 

I am unsure how to code the condition that would work for this. I have filtered the SharePoint Get Items action to return only results with a default end date (still active) and an email equal to the member in question. If the array is empty (no additional positions) then an email commanding our Listserv system to remove them is sent. If the array contains a value (they hold an additional position) then no action is taken.

 

Question: How to set condition whether SharePoint Get Items array is empty? 

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Check if filtered SharePoint list is empty

Hi @rich106,

 

Could you please show a bit more about the End Date column that you mentioned? Is it a Date type column in your SharePoint list?

Further, do you want to check if the result the "Get items" action returned is empty?

 

I have made a test on my side and please take  atry with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Get items" action, specify Site Address and List Name. Wihtin Filter Query field, type the following formula:

 

Due_x0020_Date eq '2018-03-01'

Note: The Due Date column is a Date type column in my SharePoint list.

 

 

  • Add a Condition, click "Edit in advanced mode", type the following formula:

 

@empty(body('Get_items')?['value'])

Note: On your side, you should type the follwoing formula within Condition box:

 

@empty(body('Get_ISG_Members_List_-_Post_Removal')?['value'])

The 'Get_ISG_Members_List_-_Post_Removal' is the action name of your "Get items" action.

 

 

  • Within "If/yes" branch of Condition, add a "Send me an email notificaiton" action.
  • Within "If/no" branch of Condition, do nothing.

Image reference:17.JPG

The flow works successfully as below:18.JPG

 

 

More details about using expression (WDL expression) in flow actions, please check the following article:

Using expression in flow actions

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
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
Highlighted
Community Support
Community Support

Re: Check if filtered SharePoint list is empty

Hi @rich106,

 

Could you please show a bit more about the End Date column that you mentioned? Is it a Date type column in your SharePoint list?

Further, do you want to check if the result the "Get items" action returned is empty?

 

I have made a test on my side and please take  atry with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Get items" action, specify Site Address and List Name. Wihtin Filter Query field, type the following formula:

 

Due_x0020_Date eq '2018-03-01'

Note: The Due Date column is a Date type column in my SharePoint list.

 

 

  • Add a Condition, click "Edit in advanced mode", type the following formula:

 

@empty(body('Get_items')?['value'])

Note: On your side, you should type the follwoing formula within Condition box:

 

@empty(body('Get_ISG_Members_List_-_Post_Removal')?['value'])

The 'Get_ISG_Members_List_-_Post_Removal' is the action name of your "Get items" action.

 

 

  • Within "If/yes" branch of Condition, add a "Send me an email notificaiton" action.
  • Within "If/no" branch of Condition, do nothing.

Image reference:17.JPG

The flow works successfully as below:18.JPG

 

 

More details about using expression (WDL expression) in flow actions, please check the following article:

Using expression in flow actions

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

Highlighted
Regular Visitor

Re: Check if filtered SharePoint list is empty

WORKAROUND: Note that you can no longer use Condition: edit in advanced mode.

 

So what I did was (after adding Get Items):

  1. Add a Compose action, entered the code: empty(body('Get_items')?['value'])
  2. Add a Condition,
    1. entered the Compose Output from the Dynamic Content menu in the first field,
    2. chose Is equal to for the second field,
    3. then added the True expression for the third field.
Highlighted
Community Champion
Community Champion

Re: Check if filtered SharePoint list is empty

@YouveGotSME 

Thanks for this mate! Why we would even think to add a 'Compase' action before a condition I have no idea ... but it works!!! I've just spent a day and a half trying to get my flow to work and this little tip fixed it in 5mins.

 

Cheers

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (7,937)