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

ODATA filter query with an if condition

Like (0) ShareShare
ReportReport
Posted on 20 Oct 2020 18:43:23 by 42

Hi,

I have a unique requirement where I have to apply a filter on "Get rows" from SQL Server based on a condition.

There are two columns - column A and column B.

  • If both variables passed to the flow are empty, no filter is applied.
  • If either one of the variables is not empty, the filter must be applied on that column.
  • If both variables are not empty, the filter must be applied on both columns. 

One option I see is to use multiple Conditions and query database based on the result but that means all subsequent actions must be replicated in all branches of conditions. That will make maintenance of flow difficult.

 

Is it possible to apply an If statement in an ODATA filter query? 

I tried the following expression shown in the screenshot but it is not valid.2020-10-20_13-39-51.png

Thank you!

 

  • Verified answer
    MsKautha Profile Picture
    42 on 20 Oct 2020 at 20:38:21
    Re: ODATA filter query with an if condition

    Hi @Paulie78 , I ended up composing the query before get rows action because that's the only way I could include a single quotes in the filter query. Here's the series of actions I used to make it work.

    'Application' and 'Manager' are Column 1 and 2, respectively. 

    2020-10-20_15-33-32.png

     

Helpful resources

Quick Links

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete