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 / Verification of severa...
Power Apps
Answered

Verification of severals dates

(0) ShareShare
ReportReport
Posted on by 67

Hello everyone, I have a question about checking dates.
I know this topic has already been treated several times but I do not think I crossed the audits of several dates at once when they can be null.

 

Let me explain: the user can enter 5 dates in the form, it is necessary to check that date_1 ⩽ date_2 ⩽ date_3 ⩽ date_4 ⩽ date_5. However, these fields are not all mandatory, let us say that the user does not inform date_2 and date_4, it is always necessary to keep the equality date_1 ⩽ date_3 ⩽ date_5. And this is where I block, when a date is null.

 

Is there a simple way to do this? Aside from making a huge gas machine which consist of tens and tens of nested IF, I do not see how.

 

Thanks in advance,

 

Baptiste

Categories:
I have the same question (0)
  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @BaptisteP ,

    Do you want to check dates in 5 datepickers and these dates could be blank?

    Yes, this is a little complex. Because you do not know which datepicker will be blank.

    I suggest you use collection in your issue.

    I've made a similar test for your reference:
    1)insert 5 datepickers, named DatePicker1,DatePicker1_1,DatePicker1_2,DatePicker1_3,DatePicker1_4

    set every datepicker's IsEditable to true

    (then these datepickers could be blank value)

    2)set every datepickers' OnChange:

    ClearCollect(dates,{name:1,date:DatePicker1.SelectedDate},{name:2,date:DatePicker1_1.SelectedDate},{name:3,date:DatePicker1_2.SelectedDate},{name:4,date:DatePicker1_3.SelectedDate},{name:5,date:DatePicker1_4.SelectedDate})

    //save all the dates in a collection

    3)use a label to check, if the result is true, then "date_1 ⩽ date_2 ⩽ date_3 ⩽ date_4 ⩽ date_5", or else will be false

    set the label's Text:

    First(Sort(Filter(dates,!IsBlank(date)),name)).date<=Last(FirstN(Sort(Filter(dates,!IsBlank(date)),name),2)).date&&
    //date1<=date2
    Last(FirstN(Sort(Filter(dates,!IsBlank(date)),name),2)).date<=Last(FirstN(Sort(Filter(dates,!IsBlank(date)),name),3)).date&&
    //date2<=date3
    Last(FirstN(Sort(Filter(dates,!IsBlank(date)),name),3)).date<=Last(FirstN(Sort(Filter(dates,!IsBlank(date)),name),4)).date&&
    //date3<=date4
    Last(FirstN(Sort(Filter(dates,!IsBlank(date)),name),4)).date<=Last(Sort(Filter(dates,!IsBlank(date)),name)).date
    //date4<=date5

    use filter to only get not blank dates and use sort to sort the result based on datepicker name.

     

     

    Best regards,

  • BaptisteP Profile Picture
    67 on at

    Well, it works !

    I actually never would have thought of doing it that way, thanks 🙂 

     

    Baptiste

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-yutliu-msft

    I have a problem similar to BaptisteP. But, in my case, the dates need to be filled in order Date 5> = Date4> = Date3> = Date2> = Date1. 

     

    It is not mandatory to fill in, all are in DataCard (Base Sql), in the OnSelect of each date that I put the condition:

    If (! IsBlank (DataCardValue_1disclosureoffunding> = DataCardValue_5Mudança), DataCardValue_1ofdisclosureofofinancing, Notify ("Date of first funding availability must be greater than or equal to the date of the 5th disbursed credit tracking notification),"

     

    And on Icon's Onselect to save I put:

     

    If (DataCardValue_2mudança <'DataCardValue_1, change', Notify ("Submission Error: State Change Field - Screening and Characterization.", NotificationType.Error),
    If (DataCardValue_3mudançaca <DataCardValue_2mudança, Notify ("Submission Error: Change of State Field - Credit Dossier.", NotificationType.Error),
    If (DataCardValue_4Mudança <DataCardValue_3mudança, Notify ("Submission Error: Change of State Field - Negotiation with Banks.", NotificationType.Error),
    If (DataCardValue_5Change <DataCardValue_4Change, Notify ("Submission Error: Change of State Field - Tracking Disbursed Credits.", NotificationType.Error),
    If (DataCardValue_1disclosureoffunding <DataCardValue_5Change, Notify ("Submission Error: 1st Funding Disclosure Field.", NotificationType.Error), SubmitForm (Form_PromotorNEW) and Notify ("Record saved successfully,))))).

     

    The problem is when I just fill in Date1 and the others are blank, the notification of my condition appears and does not allow me to save, but filling in the other dates is not mandatory, they just need to be filled in correctly following the order has to be greater or the same as the previous one. Please help me.



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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard