Simply put I need to only get the files that have the property WarningDate earlier than Today into my Flow.
In SharePoint WarningDate is of type calculated column, which unfortunately is not supported used in the Filter Query field of the action, and so I need to figure out how to do the same calculation using ODATA in the action filter. Hope someone can point me in the right direction!?
The calculated column finds the value like this: =IF([Alert period (days)]<>"No alert",[Contract End]-[Alert period (days)],"01/01/9999")
In people speak: IF the Alert period field is not 'No Alert' THEN subtract number of days from Contract End date ELSE set to Jan 1st 9999
The Today part of the ODATA I have figured out already, and it works fine. I will do like this:
[the calculation I am asking for] lt varToday
where varToday is a variable set to: formatDateTime(utcNow(),'yyyy-MM-dd')
Here the filter is in the current state without the part that I am waiting for tips on:
According to this recent thread, AND ODATA filter query operator is not currently supported
Do you get the files from SharePoint document library?
Could you please share a full screenshot of your flow’s configuration?
The date time column of SharePoint would be converted into UTC format automatically in Microsoft Flow:
Note: WarningDate is a calculated column in my SharePoint library with the value like this:
=IF([Alert period (days)]<>"No alert",[Contract End]-[Alert period (days)],"01/01/9999")
There is no way to format the WarningDate column within Filter Query field of “Get files (properties only)” action of SharePoint in Microsoft Flow currently, so I afraid that we could not filter the files that have the property WarningDate earlier than today with Odata Filter Query within Filter Query field.
You could consider take an alternative way to achieve your needs, I have made a test on my side, please take a try with the following workaround:
Within “Filter array” action, click “Edit in advanced mode”, type the following formula:
@less(formatDateTime(item()?['WarningDate'], 'MM/dd/yyyy'), utcNow('MM/dd/yyyy'))
The flow works successfully as below:
Hi and thanks for your replies.
First of all I find it strange to hear the the AND operator is not supported. I am getting no errors and my GET FILES filter seems to work fine, returning only items of the defined content type AND where the end date has not yet passed.
My main intention with putting as much filtering as possible into the query filter is to reduce the returned item count. As there is a current limitation of Flow not handling more than 5000 items I want to not have to do array fltering or conditions inside the flow. It's a lot better and simpler to not have to handle the unwanted items inside the flow at all. It's unfortunate that this is not possible. I was looking for something similar to a SQL CASE function. I'd still love to hear If it turns out that this actually is possible!
Currently below is my 'work around' where I am using a condition to choose to only send alerts for the contracts that have an alert date earlier than today. Interestingly enough the calculated field works fine when used in a condition.
ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.
See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.
Find your favorite faces from the community presenting at the Power Platform Community Conference!