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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / ODATA Filter Query wit...
Power Automate
Unanswered

ODATA Filter Query with if expression

(0) ShareShare
ReportReport
Posted on by 284

Hi, is it possible to use "if" expression in Filter Query? I want to add another parameter in the filter if the value is not empty/blank.

sbgoh_0-1594911074130.png

I am trying to add a "if" condition but I cannot update as the expression is invalid.

Any advise?

Categories:
  • eliotcole Profile Picture
    4,439 Moderator on at

    Hey, @sbgoh , is there a chance that you could pull the IF statement out of the expression and into a Condition action to feed a variable, and just use the variable in the ODATA?

  • sbgoh Profile Picture
    284 on at

    Hi, I tried to use filter array in if condition but the filtering is not working. Do you have any sample for your solution?

  • eliotcole Profile Picture
    4,439 Moderator on at

    Sorry, I'm not really sure where the Filter Array is coming from, @sbgoh , mate ... but just do the calculation that you're doing in the expression with flow actions, and have the result of the condition (or switch) set the value of whatever you need in the ODATA.

     

    Does that make more sense?

     

  • ScottShearer Profile Picture
    25,331 Most Valuable Professional on at

    @sbgoh 

    You can't use an if() expression in the way you want in your filter. 

     

     

  • sbgoh Profile Picture
    284 on at

     Hi eliotcole,

    I don't quite understand what you mean. My filters might be the following pt 1 & 2.

    E.g.

    1. If I want to get the records for "Customer = ABC" with "Stage = Pending".

    2. If the user leaves Customer = Blank, and Status = Pending, it means to retrieve All customers with pending status.

     

    I am able to do pt 1 alone but I don't know how to combine pt 1 & 2. Any advise?

  • stonefr33 Profile Picture
    13 on at

    Not sure if it will help in your case but I have managed something similar to what you are trying to do.

    At the beginning of my Flow I use the Initialize Variable (I would assume Compose may work as well) "if(contains(variables('InternalDomains'),variables('SenderDomain')),'Internal','External')"

    Output would then be 'Internal' Or 'External'

    CreateVariable.png

     

    In the ODATA query 
    RecipientAddress eq '@{items('ForEachRecipient')}' and Internal_x002f_External eq '@{variables('InternalOrExternal')}'
    Filter.png
    The x002f is just a forward slash in the column name

     
     
  • sbgoh Profile Picture
    284 on at

    I construct my filter query at PowerApps and got my problem solved.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 233 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 178

Last 30 days Overall leaderboard