Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

How can I over-ride a date column in a form whenever a second date column has data?

(0) ShareShare
ReportReport
Posted on by 523

I have a datepicker on the form "datevalue1" based on a CDS column "Approx Close Date" and I have a datepicker on the form "datevalue2" based on a CDS column "Actual Close Date."

Both these columns are optional.

When a user submits the form initially, they would enter an approx close date in datevalue1 (and leaving datevalue2 empty)... and nearing the time it closes, they enter the actual close date in datevalue2.

What would be a good way to have the value in datevalue2 duplicated into datevalue1, but only when datevalue2 contains data?

I hope that makes some semblance of sense, thx!

Categories:
  • Medoomi Profile Picture
    Medoomi 523 on at
    Re: How can I over-ride a date column in a form whenever a second date column has data?

    Thanks so much @eka24 

    I am still trying to understand your suggestion.

    If I set the Default Date of the Date Picker to

    If(Form1.Mode=FormMode.New,Blank(), Parent.Default)
    The parent of this Date Picker is the Card, and its Default is set to

    ThisItem.'Approx Close'
    Would that not already create a blank new record when the form mode is new? Or is there another reason why On Change of the Date Picker should also be set to

    If(Form1.Mode=FormMode.New,Blank(), Parent.Default)
    Apologies for my slowness, thx!

  • eka24 Profile Picture
    eka24 20,921 on at
    Re: How can I over-ride a date column in a form whenever a second date column has data?

    If there is a defauldate, then it cannot be blank. So look at the formula again. 

    If that should work, on Change the default date to;

    If(Form1.Mode=FormMode.New,Blank(), Parent.Default)

     

    Then you can use your formula stated.

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

     

  • Medoomi Profile Picture
    Medoomi 523 on at
    Re: How can I over-ride a date column in a form whenever a second date column has data?

    Both datepickers DefaultDate is Parent.Default

    Does the following code for DefaultDate in Date Picker DateValue1 seem like it would work:

    If(!IsBlank(DateValue2),DateValue2.SelectedDate,Parent.Default)

    What I am hoping it would do, is allow any date to be selected so long as DateValue2 is empty (whether the form mode is new, or edit)... and if DateValue2 has a date, that it would enter that date in DateValue1

    Thanks so much!

  • eka24 Profile Picture
    eka24 20,921 on at
    Re: How can I over-ride a date column in a form whenever a second date column has data?

    Am assuming that both datepickers DefaultDate is Blank(). If that is the case try this code in the DafaultDate of Datepicker2;

     

    If(Form1.Mode = FormMode.New && !IsBlank(DatePicker1), DatePicker1.SelectedDate)

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard