cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenDonahue
Skilled Sharer
Skilled Sharer

Correct syntax for a multi-filter

I want to take my large-ish table and reduce it to what needs to be looped over using multiple filter conditions. Basically, how do I do this?

 

I tried to enter my parameters into a Filter block and switch to advanced mode to get the code, but I'm still missing something.

 

Here is the Advanced Mode for the first parameter:

@greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula'])

 

Here is the Advanced Mode code for the second parameter:

@(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula'])) and (equals(empty(item()?['Audit-Recorded-By']), true))

 

Here is a list of my failed attempts:

and(not(equals(empty(items('LRPIAT-SPSFACD')?['Assigned-By']), true)),equals(empty(items('FilterForActionableData')?['Audit-Recorded-By']),true))
(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula'])) and (equals(empty(item()?['Audit-Recorded-By']), true))
@(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula'])) and (equals(empty(item()?['Audit-Recorded-By']), true))
 
If there is different code for use in an OData query and for the Filter block, it would be great to know both.
 
Thank you for your assistance!!
 
3 ACCEPTED SOLUTIONS

Accepted Solutions
v-alzhan-msft
Community Support
Community Support

Hi @BenDonahue ,

 

Could you please share a screenshot of the configuration of the flow?

 

You could take a try with expression below:

@and(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula']),greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula']),equals(empty(item()?['Audit-Recorded-By']), true))

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
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

efialttes
Super User
Super User

Hi!

I guess you are referring to 'Filter array' action block, right? If your second 'parameter'...

@(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula'])) and (equals(empty(item()?['Audit-Recorded-By']), true))

...seems wrong to me. I would try this instead:

@And(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula']), equals(empty(item()?['Audit-Recorded-By']), true))

AS you said, OData expressions syntax differs from WDL expressions syntax

More on Sharepoint ODATA syntax here:

https://sharepains.com/2018/11/12/sharepoint-get-items-odata-filter-query/

More on and() related ODATA expressions syntax here:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#a...

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

BenDonahue
Skilled Sharer
Skilled Sharer

For my purposes, here is the final, functional code I am using inmy Filter Array block:

 

@And(greaterOrEquals(body('Current_time'),formatDateTime(addDays('1899-12-30',int(item()?['Audit-Due-Date-Formula'])),'yyyy-MM-dd')),equals(item()?['Audit-Assigned-To-Email'],items('ATE-Roster')?['OM Email']),equals(empty(item()?['Audit-Recorded-By']), true))

 

This was constructed by creating these three statements and testing them, then adding an "and" and some commas and 2 parentheses:

@greaterOrEquals(body('Current_time'),formatDateTime(addDays('1899-12-30',int(item()?['Audit-Due-Date-Formula'])),'yyyy-MM-dd'))
@equals(item()?['Audit-Assigned-To-Email'],items('ATE-Roster')?['OM Email'])
@equals(empty(item()?['Audit-Recorded-By']), true)

 

Also, thank you to @efialttes and @v-alzhan-msft for your help and guidance. I would not have the solution without your assistance, to be sure.

View solution in original post

6 REPLIES 6
v-alzhan-msft
Community Support
Community Support

Hi @BenDonahue ,

 

Could you please share a screenshot of the configuration of the flow?

 

You could take a try with expression below:

@and(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula']),greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula']),equals(empty(item()?['Audit-Recorded-By']), true))

 

Best Regards,

Alice

 

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

 

efialttes
Super User
Super User

Hi!

I guess you are referring to 'Filter array' action block, right? If your second 'parameter'...

@(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula'])) and (equals(empty(item()?['Audit-Recorded-By']), true))

...seems wrong to me. I would try this instead:

@And(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula']), equals(empty(item()?['Audit-Recorded-By']), true))

AS you said, OData expressions syntax differs from WDL expressions syntax

More on Sharepoint ODATA syntax here:

https://sharepains.com/2018/11/12/sharepoint-get-items-odata-filter-query/

More on and() related ODATA expressions syntax here:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#a...

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



@efialttes ,

First, thank you for, again, supplying your time and effort to help me.

 

I am trying to use this ODATA query in a "List rows present in a table." I don't know if that changes things, but I am getting a null return for my "item()?['']" it seems:

BenDonahue_0-1601469237501.png

for this expression

and(greaterOrEquals(body('Current_time'), item()?['Audit-Due-Date-Formula']), equals(empty(item()?['Audit-Recorded-By']), true))

Currently, I have data in all these fields. In the future, I might not, so I will have to deal with that, too.

 

If I could at least get this expression to work, I would have a very short list to work with:

equals(item()?['Audit-Assigned-To-Name'],items('ATE-Roster')?['OM Name'])
but this returns this error message:
 
BenDonahue_0-1601470054111.png

 

 Here is some context:

 
BenDonahue_1-1601470068035.png

Thank you again for your assistance. I will get into the sharepains article now.

Hi!

THe Filter Query error comes from the fact it expects an ODATA expression as its input.

And, ODATA syntax is different from WDL sintax.

GReat article on ODATA expressions here:

https://sharepains.com/2018/11/12/sharepoint-get-items-odata-filter-query/

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



BenDonahue
Skilled Sharer
Skilled Sharer

For my purposes, here is the final, functional code I am using inmy Filter Array block:

 

@And(greaterOrEquals(body('Current_time'),formatDateTime(addDays('1899-12-30',int(item()?['Audit-Due-Date-Formula'])),'yyyy-MM-dd')),equals(item()?['Audit-Assigned-To-Email'],items('ATE-Roster')?['OM Email']),equals(empty(item()?['Audit-Recorded-By']), true))

 

This was constructed by creating these three statements and testing them, then adding an "and" and some commas and 2 parentheses:

@greaterOrEquals(body('Current_time'),formatDateTime(addDays('1899-12-30',int(item()?['Audit-Due-Date-Formula'])),'yyyy-MM-dd'))
@equals(item()?['Audit-Assigned-To-Email'],items('ATE-Roster')?['OM Email'])
@equals(empty(item()?['Audit-Recorded-By']), true)

 

Also, thank you to @efialttes and @v-alzhan-msft for your help and guidance. I would not have the solution without your assistance, to be sure.

@BenDonahue 

Issue solved, right?

Hurray! Great Job!

Thanx for making this community great!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (2,317)