cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SylvieLet17
Level 8

ODATA Query Filter versus Condition + Apply to each

Hi all, 

 

I have a general question about Flow performance. 

I'm new to ODATA, but I've been working with Flow for a while. 

 

I have a library with 600+ documents and steadily increasing. 

If I need to build a recurring flow to check on documents that are "expired" based on a date or text column, would it be better in terms of performance to build a "Get file properties" in an apply to each with a condition, or to build an ODATA guery filter in terms of performance?

I did try a condition-based flow and noticed it was extremely slow, but I haven't successfully managed to try an ODATA query yet (having issues with dates). Just wondering if it is worth it, or if it will be the same performance?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: ODATA Query Filter versus Condition + Apply to each

Hi @SylvieLet17,

 

When there are mounting items in your list, it would be better to use Odata filter query to return the needed items. Otherwise, you will have to filter with each item with a Condition and which will be very slow.

 

What’s the issue you are having with date column?

 

When using Odata filter query with Date column, I would suggest you use a custom date column with date only format, but not the default date column such as Created/Modified.

 

Say I have a date column called Date, I want to filter out items that Date equals to today. I will use the following code:

Date eq ‘formatDateTime(utcnow(),’yyyy-MM-dd’)’

1.PNG

 

Please check this doc for more details:

https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
ThreeTen
Level: Powered On

Re: ODATA Query Filter versus Condition + Apply to each

performance wise ODATA will beat out anything you do in flow (assuming the database is on is a sufficiently powerful server or you are querying a microsoft service like sharepoint, or Dynamics/CDS)


In flow you can utilize the Filter data operation action (rather than a conditional for-each) which still wont beat out an ODATA query..but usually takes a second max

Community Support Team
Community Support Team

Re: ODATA Query Filter versus Condition + Apply to each

Hi @SylvieLet17,

 

When there are mounting items in your list, it would be better to use Odata filter query to return the needed items. Otherwise, you will have to filter with each item with a Condition and which will be very slow.

 

What’s the issue you are having with date column?

 

When using Odata filter query with Date column, I would suggest you use a custom date column with date only format, but not the default date column such as Created/Modified.

 

Say I have a date column called Date, I want to filter out items that Date equals to today. I will use the following code:

Date eq ‘formatDateTime(utcnow(),’yyyy-MM-dd’)’

1.PNG

 

Please check this doc for more details:

https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Administrator
Administrator

Re: ODATA Query Filter versus Condition + Apply to each

Hello, @SylvieLet17!

 

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-yamao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!


Thank you for being an active member of the Flow Community!

 

-Gabriel
Flow Community Manager

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!
SylvieLet17
Level 8

Re: ODATA Query Filter versus Condition + Apply to each

Hi Mabel, 

No matter what I do I always get "The Expression \"Date eq 2018-10-10\" is not valid. 

 

I've tried using all kinds of different columns. I've used text custom date columns, and I've used the out of the box "Created" and "Modified" dates. 

 

See my error below:Odata_query1.pngodata query2.png

Super User
Super User

Re: ODATA Query Filter versus Condition + Apply to each

You need to wrap single quotes around your date string: Date eq ‘2018-10-09’

-Mark
SylvieLet17
Level 8

Re: ODATA Query Filter versus Condition + Apply to each

Wow.

Sometimes I surprise even myself with my own stupidity. 

Thanks Mark, that worked. (Obviously)

Highlighted
Super User
Super User

Re: ODATA Query Filter versus Condition + Apply to each

We have all been there!

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,178)