cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Islam209
New Member

Filter array for dates

I am trying to create a flow for getting notification when uploaded documents in SharePoint online get expired and i put an expression in filter array is less than "adddays(utcnow(yyyy-MM-dd),0) ,but when i tested it ,error was come 

 

The execution of template action 'Filter_array' failed: The evaluation of 'query' action 'where' expression '@less(item()?['Expirationdate'], 'adddays(utcnow(yyyy-MM-dd),1)')' failed: 'The template language function 'less' expects two parameter of matching types. The function was invoked with values of type 'Null' and 'String' that do not match.'.

 

 
1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @Islam209,

 

It looks like one of the items in your list does not have an expiration date. You can include an empty check in your expression to handle these kind of null values.


Can you try the expression below:

@less(if(empty(item()?['Expirationdate']), 'No expiration date', item()?['Expirationdate']), adddays(utcnow('yyyy-MM-dd'), 1))

 

View solution in original post

3 REPLIES 3
Expiscornovus
Super User
Super User

Hi @Islam209,

 

It looks like one of the items in your list does not have an expiration date. You can include an empty check in your expression to handle these kind of null values.


Can you try the expression below:

@less(if(empty(item()?['Expirationdate']), 'No expiration date', item()?['Expirationdate']), adddays(utcnow('yyyy-MM-dd'), 1))

 

I do this a bit differently. I create a scheduled flow with it scheduled to run once per day. I initialize a filter date and then set it to the current date with the expression:

formatDateTime(utcNow(),'yyyy-MM-dd')

In the get items action I use the filter date on the expiration date (Notice Date in my example below) to get the items where the expiration date is equal to today:

 

Web capture_27-6-2022_101026_emea.flow.microsoft.com.jpeg

Thanks @Expiscornovus , this was helpful for me 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,928)