cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
janp
Regular Visitor

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

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
Regular Visitor

screenshots of flow and result

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

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.

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

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.

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.

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
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,357)