web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : aAYgzjzWRdwIZT9V5JegEV
Power Automate - Building Flows
Answered

How to compare two dates by month in a "get items" filter query

Like (0) ShareShare
ReportReport
Posted on 25 Aug 2018 23:54:22 by 193

I have been trying to solve the following simple problem:

- send an email with the current month employee's anniversaries

 

The filter needs to isolate the month (MM) only for each variable

 

I have settled on "Get items" with a "Filter query" but have been unsuccessful. Anytime I try and set MM only, it fails with the following error:


InvalidTemplate. Unable to process template language expressions in action 'Get_items' inputs at line '1' and column '2528': 'In function 'formatDateTime', the value provided for date time string 'OData__x0077_q99' was not valid. The datetime string must match ISO 8601 format.'.

 

It works when I do not try and format the variables (instead of "ge" it should be "eq" but I was playing with it)

screen1.pngscreen2.png


Any ideas on how to make this work?

I have the same question (0)
  • wiredupjax Profile Picture
    193 on 29 Aug 2018 at 02:21:15
    Re: How to compare two dates by month in a "get items" filter query

    Correct! I missed that you need to chose fields as item()?['FIELDNAME']

    Thank you so much!

  • Verified answer
    v-yuazh-msft Profile Picture
    on 29 Aug 2018 at 02:11:39
    Re: How to compare two dates by month in a "get items" filter query

    Hi @wiredupjax,

     

    Please refer to screenshot below:

    Capture.PNG

     

    Best regards,

    Alice

  • wiredupjax Profile Picture
    193 on 28 Aug 2018 at 22:55:14
    Re: How to compare two dates by month in a "get items" filter query

    Alice, looks good - how do I take the filter array data send it in a single email?  I only need a few columns from the record.

     

    I've seen some other solutions on the board: here and here

     

    However, when I begin to select certain fields, the "Apply to items" is automatically inserted, it drops the *body and switches items (which I switch back).

     

    I cannot take the HTML table BODY field outside the Apply to items loop and insert it into an email.  If I place the email inside the loop, then I get 10 emails instead of 1 with 10 items.

     

     

  • v-yuazh-msft Profile Picture
    on 28 Aug 2018 at 02:28:38
    Re: How to compare two dates by month in a "get items" filter query

    Hi @wiredupjax,

     

    Could you please share more details about the date column in your sharepoint list with expression "OData__x0077_q99" in flow?

    You could take a try tp add a "Filter Array" action to filter the items meet your requirement.

     

    I have made a test on my side to create a "OData 99" column in the sahrepoint list as screenshot below:

    Capture.PNG

     

    You could refer to screenshot below to create the flow:

     

    Capture.PNG

     

    The expression in the initial variable as below:

    formatDateTime(utcNow(),'MM')

    The expression in the Filter Array as below:

    @equals(formatDateTime(item()?['OData_x0020_q99'], 'MM'), variables('Today_Date'))

    The flow would run successfully as below:

    Capture.PNG

     

     

    Best regards,

    Alice

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 954 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 650 Moderator

#3
trice602 Profile Picture

trice602 327 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading complete