Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

ODATA and filtering using runtime variables

(0) ShareShare
ReportReport
Posted on by 11

I'm building a flow that connects to a Sharepoint Online list and filters the list down using ODATA.  I can get the basic filters to work, but I need one final filter that uses the current system datetime to compare to a datetime value field in the list.  For example:

 

Disposition eq 'Initial' and Status eq 'Pending' and SchedConfDate le =Now()

 

Where SchedConfDate is a datetime column from my SPO list.  I need to filter my data down to just those list items whose SchedConfDate is less than or equal to "Now" or "Sysdate" or some other runtime variable/parameter that reprents the current date and time.  Does anyone know if ODATA supports using these runtime variables because I have not been able to get any permutation of "Now" or "UTCNow" to work.  Or is there another way this could be achieved?

 

Best Regards,

Mike

  • Community Power Platform Member Profile Picture
    on at
    Re: ODATA and filtering using runtime variables

    You didn't really have to add that "Compose" step.  Just use the same syntax in the Filter Query field of the Get items. Worked for me:

    Clipboard01.png

  • ReflexBCS Profile Picture
    7 on at
    Re: ODATA and filtering using runtime variables

    In case other people are still looking - the following approach worked for me;

    1) add a "compose" action to construct the filter; Inputs = Title eq '<<insert variable from previous step>>'

    I just typed the column name without anything around it,

    then type: eq

    then (single quote to open) type :  '

    then clicked into dynamic content to select the value from previous step (when item is created or modified)

    then (single quote to close) type: '

     

    2) Next create the "get items" step

    Select your site and list

    Go to "Advanced Options" to show the Filter Query

    Click and select from dynamic content "Output" from the Compose step.

     

    You're done. Hope this is helpful.

  • efialtes Profile Picture
    350 on at
    Re: ODATA and filtering using runtime variables

    @MThomas Maybe the problem is because of mixing WDL sintax+expressions with ODATA sintax+expressions. I would be great if Flow team can confirm if the following link is an official and thus valid ODATA tutorial link for Flow related ODATA expressions:

    https://msdn.microsoft.com/es-es/library/hh169248(v=nav.90).aspx

     

    What I see is that 'greater' a WDL expression, 'gt' seems to be its equivalent in ODATA. Please note utcnow() is also WDL, so before injecting it as part as an ODATA expression, you must make sure it has been already interpreted into the proper value.

     

    After executing the flow, you can verify both inputs and outputs of each action block, thus you can see if the ODATA expression has been built according to your expectations

     

  • MThomas Profile Picture
    11 on at
    Re: ODATA and filtering using runtime variables

    I'm still struggling with the syntax.  When I try to write the filter in basic mode:

    ComposeFilterBasic.PNG

     

    It fails saying that "greater" is not recognized.  I figured this is because I was mixing basic and advanced syntax, so I tried it all in advanced syntax:

     

     

    ComposeFilterAdvanced.PNG

     

    Where it fails saying that "and" is not supported or it is invalid.  So, I think I have syntax errors.  Any idea on the correct syntax for:

     

    Disposition = "Initial"

    Status = "Pending"

    SchedConfDate > utcnow()

     

    ???

     

    Any help is greatly appreciated!

     

    Thanks

    Mike

     

     

     

     

     

  • efialtes Profile Picture
    350 on at
    Re: ODATA and filtering using runtime variables

    @MThomas

    It seems the rollout has been completed, I can see the expressions tab!

  • MThomas Profile Picture
    11 on at
    Re: ODATA and filtering using runtime variables

    This sounds like EXACTLY what I need, but I too do not see Expression as an option right now.  When will this be rolled out to everyone?

     

    Thanks,

    Mike

  • efialtes Profile Picture
    350 on at
    Re: ODATA and filtering using runtime variables

    @MThomas

    Have you tried building the ODATA expression in a Compose action block?  Soon we will be able to invoke WDL functions in acton blocks' input fields as announced in https://flow.microsoft.com/en-us/blog/use-expressions-in-actions/ ; but I guess the rollout of such feature has not been completed yet, so Compose action block is a good workaround. The expression in the screenshot is quite simple, but you can buid more complex expressions by using WDL expressions like utcnow()

     

    ODATA_compose.png

     

     

     

  • v-monli-msft Profile Picture
    on at
    Re: ODATA and filtering using runtime variables

    Hi @MThomas,

     

    I have escalated this issue to the pg and will update here if I got further information.

     

    Regards,

    Mona

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1