cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenDonahue
Continued Contributor
Continued Contributor

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 III
Super User III

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
Continued Contributor
Continued Contributor

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.

 

View solution in original post

efialttes
Super User III
Super User III

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
Continued Contributor
Continued Contributor

@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
Continued Contributor
Continued Contributor

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

@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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (64,239)