web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Select action to filte...
Power Automate
Unanswered

Select action to filter on date fails on null values

(0) ShareShare
ReportReport
Posted on by 7

I am trying to create a select action that filters out items from Get Items previous to today's date, but the flow fails on Null values.

 

Here is the function I have in the Map: less(item()?['SignOutDateTime'], formatdatetime(utcNow('yyy-MM-dd')))

 

Error: InvalidTemplate. The execution of template action 'Select_2' failed: The evaluation of 'query' action 'where' expression '{ "@item()?['SignOutDateTime']": "@less(item()?['SignOutDateTime'], formatdatetime(utcNow('yyy-MM-dd')))" }' failed: 'Unable to evaluate template language expression '@item()?['SignOutDateTime']' as JSON property name: the expression value of type 'Null' could not be used as property name.'.

 

I need to filter for not null and older than today.

Categories:
I have the same question (0)
  • wskinnermctc Profile Picture
    6,519 Moderator on at

    You need to use the empty() expression with an if() expression to check the value first. If it is empty() the result will be true, so you need to set the true part of the if() expression to '' blank or something else, then in the false part of the if() you can do the formatdatetime() expression

     

    So it will be something like if(empty({DateValue}),'',formatDateTime({DateValue}))

  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

    Why not just put a filter before the select to remove any rows where the SignOutDateTime is equal to null? Then run your select which will be free of null entries?

  • mhamerton Profile Picture
    7 on at

    Thank you, I did come across this type of solution, but couldn't get it to work either, could be syntax. Here is the formula I most recently used: if(empty(item()?['SignOutDateTime']),utcNow(),formatDateTime(item()?['SignOutDateTime']))

     

    Error: The evaluation of 'query' action 'where' expression '{ "@item()?['SignOutDateTime']": "@if(empty(item()?['SignOutDateTime']),utcNow(),formatDateTime(item()?['SignOutDateTime']))" }' failed: 'Unable to evaluate template language expression '@item()?['SignOutDateTime']' as JSON property name: the expression value of type 'Null' could not be used as property name.'.

     

    I am putting this expression in the correct place am I not?

     

    mhamerton_0-1689865385739.png

     

  • wskinnermctc Profile Picture
    6,519 Moderator on at

    I don't think the problem is the expression on the right side of the Map where you Enter Value. The problem is the left side of the Map where you Enter Key. 

     

    You have that green Dynamic content on the left side of the Map as the Key which is basically like a row name, and that is not allowed to be blank. 

     

    So you are dealing with blank values on the right side with the expression, but doing nothing to the left side where the Key should be if the value is blank.

     

    I agree with @Paulie78 with needing to filter out the dates some other way.

    I don't really understand what the flow is doing with the Select 2 being inside of an Apply to Each?

  • Paulie78 Profile Picture
    8,422 Moderator on at

    It looks to me like you don't need the apply to each at all. It should be:

     

    1. Get Items 
    2. Filter
    3. Select

    or perhaps even just:

     

    1. Get Items (with odata filter to exclude ones without dates).
    2. Select

     

  • mhamerton Profile Picture
    7 on at

    Paulie78, your solution worked well. I do need the Null values as the email sends a report based on these outstanding fields.

     

    Thanks again, I was pulling my hair out.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard