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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / compare to blank - gre...
Power Apps
Answered

compare to blank - greater or smaller?

(0) ShareShare
ReportReport
Posted on by 104

Hi all,

 

I am trying to determine if a number of times are in the right sequence. I'm doing this by:

If( time1 <= time2 && time2<=time3 && ..., sequence true, sequence false)

 

If all time fields are not blank this works quite fine. Unfortunately there are some use cases where not all time fields will be filled but instead left blank. The others still need to be tested for sequenceiality (is this a real english word?) In this case the above doesn't work.

Is this because blank is greater or smaller than anything non blank or because it is generally impossible to compare something to nothing?

 

Thanks in advance for your help and thoughts

Hansjoerg

Categories:
I have the same question (0)
  • Verified answer
    rb Profile Picture
    835 Super User 2024 Season 1 on at

    I found this interesting, so I have visualised some very explicit tests.

    It is obvious that Blank() is less than any date, according to PowerApps logic. Therefore, we just need to define our own logic to say that if date N+1 is Blank(), then consider date N to be in sequence:

    metsshan_0-1658898962206.png

    (DatePicker1.SelectedDate <= DatePicker2.SelectedDate || IsBlank(DatePicker2.SelectedDate)) && (DatePicker2.SelectedDate <= DatePicker3.SelectedDate || IsBlank(DatePicker3.SelectedDate))

    You will, however, get true if all dates are blank. Maybe this isn't what you need, but as you can see, you have to define your own logic for dealing with Blanks.

  • ha_wai Profile Picture
    104 on at

    Thanks @metsshan 

    unfortunately for me PowerApps logic isn't so obvious.

    If blanks would indeed be considered < non blanks just turning around the comparisons should have worked (starting with the latest time point backwards)

     I've just trialled timex <= timex-1 && timex-1 <= timex-2....

    If all fields are filled in it works the same as the upwards comparison but with blanks it remains false. My conclusion from that is that blanks are not really <nonblanks.

     

    So I'll have to include testing for blank into the logic. This will make the code rather messy and long as I'm looking at 12 time points 😞

     

    I'll keep this open for the moment and report if the combined logic works.

  • ha_wai Profile Picture
    104 on at

    @metsshan 

    The combined logic works, thank you very much for your help!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 85

#2
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard