cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
janp
Level: Powered On

troubles filtering date after fetching rows from a table

I'm fetching a table from an excel file on my onedrive for business.

I want to filter the table on a date field (Column1) containing dates formatted like 2019-10-15T07:30:14.224Z, only keeping the records with the date set today.

In the filter array I've set this formula 

@equals(formatDateTime(item()?['Column1'],'yyyy/MM/dd'), utcnow('yyyy/MM/dd'))

 

But no output is generated.
When checking the result i get :

INPUT:
From
[
{
"@odata.etag": "",
"ItemInternalId": "0fEXGJmpaow",
"Column1": "2019-08-01T05:29:39.826Z",
"__PowerAppsId__": "0fEXGJmpaow"
},...

]

 

OUTPUT:
Body

  []

 

I could use some help with this

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: troubles filtering date after fetching rows from a table

This is a common problem when working with dates.  The issue is that dates always include both a date and a time component.  But you are trying to just check whether the dates are equal, not the times.  To do that you need to filter out the date portion on boht sides of the equation.  Use the same FormatDateTime() function around UTCNow() that you use for Column 1.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

6 REPLIES 6
janp
Level: Powered On

Re: troubles filtering date after fetching rows from a table

screenshots of flow and result

2019-10-15 14_05_34-Run History _ Microsoft Flow.png

Dual Super User
Dual Super User

Re: troubles filtering date after fetching rows from a table

This is a common problem when working with dates.  The issue is that dates always include both a date and a time component.  But you are trying to just check whether the dates are equal, not the times.  To do that you need to filter out the date portion on boht sides of the equation.  Use the same FormatDateTime() function around UTCNow() that you use for Column 1.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

janp
Level: Powered On

Re: troubles filtering date after fetching rows from a table

Hi,

 

Unfortunately, when I use the formatdatetime function on the utcnow part, it returns an error.

2019-10-15 14_34_13-Edit your flow _ Microsoft Flow.png

Dual Super User
Dual Super User

Re: troubles filtering date after fetching rows from a table

You are missing a closing ')' parentheses on your formula.  You close out the FormatDateTime, but not the @equals.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
janp
Level: Powered On

Re: troubles filtering date after fetching rows from a table

Thanks for your help, it is working now, however only if the excel table contains less than 256 rows.

I believe I've read about that somewhere in another thread.

Dual Super User
Dual Super User

Re: troubles filtering date after fetching rows from a table

Take a look at the section covering Pagination in the following article.

 

https://flow.microsoft.com/en-us/blog/four-connector-action-settings/



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 395 members 6,758 guests
Please welcome our newest community members: