Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Filter array for dates

(0) ShareShare
ReportReport
Posted on by 8

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.'.

 

 
  • Islam209 Profile Picture
    8 on at
    Re: Filter array for dates

    Thanks @Expiscornovus , this was helpful for me 

  • David- Profile Picture
    1,254 on at
    Re: Filter array for dates

    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

  • Verified answer
    Expiscornovus Profile Picture
    31,635 Most Valuable Professional on at
    Re: Filter array for dates

    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))

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow