Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 4XOSpDKfHxs0vYFQNDVIZi
Power Apps - Building Power Apps
Answered

Power Apps Modern Date Picker Clear

Like (0) ShareShare
ReportReport
Posted on 22 Jan 2024 20:14:22 by 42

Hi,

 

I have Form in my Power App linked to a Sharepoint Laptop Loan list. It has a return date which sets off a power automate script to send the user a return device email. My issue is that on the EditForm the date field can’t seem to be set to blank (which is important so the Power Automate script doesn’t think the device is out on loan). I’ve tried to use a separate button to update the field using Blank(DataCard13_1) but it sets the date to 31st Jan. The cards default value is the item in the spreadsheet.

 

Thanks.

Categories:
  • Specthildur Profile Picture
    42 on 23 Jan 2024 at 18:11:06
    Re: Power Apps Modern Date Picker Clear

    @Amik 

     

    Thank you for all of your help, everything is working now!!

     

    Have a great day.

     

  • Verified answer
    Ami K Profile Picture
    15,665 Super User 2024 Season 1 on 23 Jan 2024 at 13:54:02
    Re: Power Apps Modern Date Picker Clear

    @Specthildur - The UpdateContext function declares a Context Variable which is scoped to the current screen. Given the Edit Form is on a different screen, the UpdateContext would not work here.

     

    It is possible to use a Global Variable which is scoped to the entire app, or parse the Context Variable over to the other screen.

     

    For the latter, on the OnSelect property of your Gallery, or on the OnSelect property of whatever Icon/Control you're using to Navigate to the Form Screen, use the following syntax:

     

    Navigate(
     'Your Edit Form Screen',
     ScreenTransition.None,
     {ctx_reset: false}
    );
    EditForm('Your Form')
  • Specthildur Profile Picture
    42 on 23 Jan 2024 at 08:18:40
    Re: Power Apps Modern Date Picker Clear

    Hi @Amik

     

    Thank you, this did the trick and now I can reset the date successfully! However there is one slight issue still. When editing a selection the date shows as blank and not what the default parent date should be, any suggestions? Although it shows blank, on my viewing screen the date does appear there, just seems like it's blanking it by default when editing that item. I have 3 screens, a Gallery view screen, a view form for a selected gallery item and an edit form for that item.

     

    I did make sure to use 'UpdateContext({ctx_reset: false})' on my 'edit' button on the item.  Attached screenshots of what shows on the 'view' screen and then what appears on the 'edit' screen. View screen uses a Mordern Form as well, but the edit button is just a navigation button to the edit form screen.

     

     

  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on 22 Jan 2024 at 21:46:45
    Re: Power Apps Modern Date Picker Clear

    @Specthildur - for the Modern Date control use the SelectedDate property.

     

    Regarding this section:

     

    UpdateContext({ctx_reset: false});
    UpdateContext({ctx_reset: true});
    UpdateContext({ctx_reset_date: ""});
    Reset('Your Date Picker')

     

    This belongs on the OnSelect property of the Button control, not on the Date Control.

  • Specthildur Profile Picture
    42 on 22 Jan 2024 at 21:29:35
    Re: Power Apps Modern Date Picker Clear

    Hi @Amik 

     

    Thank you for your response. I'm new to powerapps so apologies in advance for any mistakes.

     

    Just following through with your guidance, your first two basic steps worked great, except it wouldn't show the gallery date and would reset it regardless even if an entry had an expected date. If I edited a form inputed a date, then it would reset again.

     

    I then tried following the next bit of guidance but the Modern Date Picker doesn't have a 'DefaultDate' or 'OnSelect' options unfortunately. I did try and use 'SelectedDate' for 'DefaultDate' but when entering

     

    UpdateContext({ctx_reset: false});
    UpdateContext({ctx_reset: true});
    UpdateContext({ctx_reset_date: ""});
    Reset(DataCardKey13_1)

     

    It says that it expects DataCardKey13_1 (My Expected Return Date Picker) to have a 'resettable control as its input'

     

    Any suggestions appreciated.

     

  • Verified answer
    Ami K Profile Picture
    15,665 Super User 2024 Season 1 on 22 Jan 2024 at 20:23:03
    Re: Power Apps Modern Date Picker Clear

    @Specthildur - 

     

    Basic example:

    Add a Button or an Icon control into your App. On the OnSelect property of that control, enter:

     

    UpdateContext({ctx_reset_date: ""});
    Reset('Your DatePicker')

     

    On the DefaultDate property of the Date Picker control, enter:

     

    ctx_reset_date

     

    For a Date Control embedded into an Edit Form control, I would approach it this way:

     

    Add a Button or Icon into the one of the Data Cards (most logically I would place the control inside the Data Card which holds the Date Picker control).

     

    On the OnSelect property of the Button, enter:

     

    UpdateContext({ctx_reset: false});
    UpdateContext({ctx_reset: true});
    UpdateContext({ctx_reset_date: ""});
    Reset('Your Date Picker')

     

    On the DefaultDate property of the Date Picker control, enter:

     

    If(
     ctx_reset,
     ctx_reset_date,
     Parent.Default
    )

     

    Depending on how you're populating the Item property of the Edit Form (for example via a Gallery selection), ensure you set the context variable to false on the OnSelect property of the Gallery using:

     

    UpdateContext({ctx_reset: false});

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 20

#2
BCBuizer Profile Picture

BCBuizer 10 Super User 2025 Season 1

#2
LC-26081402-0 Profile Picture

LC-26081402-0 10

Overall leaderboard
Loading started