cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MAiki
Frequent Visitor

Date Picker

Greetz,

 

Just a noob question, i'm using a datepicker and i want it to remember the selected date on it. I mean not Defaultdate = Now() but the date you selected in an earlier session.

 

Thx in advance..

 

Maik

1 ACCEPTED SOLUTION

Accepted Solutions

I suggest you rather inset a Datepicker into the Gallery and Change the date from inside the Gallery instead of outside the Gallery. Unless you want same dates for all.

Also what code is on the Datepicker inside the Gallery?

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

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.

View solution in original post

13 REPLIES 13
MAiki
Frequent Visitor

Pfff can't find it 🤣

Pstork1
Dual Super User III
Dual Super User III

Now() is a function that always loads todays date.  So it doesn't remember what the date was it just loads todays date.  The date picker doesn't maintain any storage after the app closes.  So to get it to use the last date selected you need to save that date somewhere and then use it to set the default in an If() that checks whether a date was saved or not.  If not it uses today, if there was a saved date it uses that one.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Set a Variable on the OnSelect of the DatePicker:

Set(varLastDate,DatePicker1.SelectedDate)

 

Then you can use varLastDate which would contain the earlier date selected

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

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.

MAiki
Frequent Visitor

Oke i understand the idea 🙂 do you have an example? Do i save it in a textinput and the set the defaultdate to that textinput or do i think to easy now 🙂

 

Thx in advance..

Pstork1
Dual Super User III
Dual Super User III

As @eka24 said you can save it in a local variable.  That will work until you close the app.  But if you want it to reset after closing and opening the app you need to save it to a data source of some kind.  Then when you start the app load the value from the data source to a local variable.  Set the defaultDate of the datepicker as follows.

if(isBlank(variableName),Now(),variableName)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
MAiki
Frequent Visitor

I need the datepicker to be the date i selected because i fill a column in a list with that date and after closing it has to be that date 🙂

 

 

Can you give a screen shot to explain further your points. How many datepickers are you using?

Also are you using a form?

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

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.

 

MAiki
Frequent Visitor

I'm using a list for the students and i redirect Datum to DatePicker, with the button i patch the Datum column with the date and that works fine but the date keeps changing on opening the app in a new session 😞 The date in the datepicker has to be the date set. I don't use a form, it's just an app for checking if there is a spot on that date (max 8 per moment, that is a list).

 

Mny Thx allready..

(just a noob here)

 

Screenshot 2021-03-23 at 16.26.10.png

I suggest you rather inset a Datepicker into the Gallery and Change the date from inside the Gallery instead of outside the Gallery. Unless you want same dates for all.

Also what code is on the Datepicker inside the Gallery?

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

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.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,769)