cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HumbleGuy
New Member

How to compare two dates in filter query

Hi Team, I am trying to retrieve the data based on odata filter query for that i am passing the below expression

HumbleGuy_0-1623328385705.png

 

kindly can someone please help me as i am unable to resolve these two issues. Thanks in advance.

2 REPLIES 2
Gopala_Krishna
Super User
Super User

@HumbleGuy 

For the issue related to the presence of single quote in the search string you can format your OData expression as below and that should start working fine as expected.

 

name eq 'carer''s leave' and the action would start working fine as expected.

 

For the one related to the date fields, I don't think Power Automate has or supports any function like year/month/date to retrieve the specific Year, Month and Date values from the given date. I am unable to see any of those listed in the documentation Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs.

 

If you want to extract the information, you can make use of formatDateTime function and specify only the month format to retrieve the month value and only year format to retrieve the year value, so on and so forth.

 

------------------------------------------------------------------------------------------------------------------------------

If the information shared helps, please consider giving a thumbs up  👍 and mark solution as resolved

Hi @Gopala_Krishna,

 

The comparison value also coming from another connector as field so i am completely not aware what value is coming in that comparison field.

 

query : name eq 'LeaveReason'

 

this expression is trying to pick the data from another crm entity whose name mathes with the LeaveReason

Here LeaveReason can be anything like carer's leave or sick leave

Due to having the single quote in the comparison string getting the error.

I tried the replace function but seems i  was not passing the correct values due to that it wasn't worked as expected.

 

Basically i am trying all these in logic app only.

 

Thanks.

 

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

Users online (20,964)