i have a datacard with the date picker and time controls. I can set the default of the datacard to Now() and it will populate the date and time with no issues. however i dont want the default to be now() as everytime i edit a record it will default to now() and not the date and time that was orignially selected in the record.
So how to i use a button to update the date and time datacard?
Solved! Go to Solution.
Here are the steps to do this.
Add a button and set the OnSelect property to this formula:
Unlock your data card and change the default property of the text input control to the formula shown beneath. Modify the value of the second argument so that it refers to your data item.
If(IsBlank(DateNow), ThisItem.EndDate, DateNow)
Select your screen and set the OnHidden property to this:
You should now be able to use the button to set the date.
so the more i tested this i have come to the conclusion that its not working as intended. As i originally stated my datacard is made up of the date picker and a drop down for both hour and minute.
I can set the data card no problem to now() and it "updates" the datepicker and hour and minute dropdowns. However it seems that the actual date and time values do not get stored in the hourvalue, minute value, and datevalue fields. So when i save it doesnt actualy save the now() date and time.
That sounds strange. If you were to update the hour and minute values manually (rather than using the now button), and to then save the record, does the form save the new value successfully to the data source?
yes it is strange. if using your scenario as soon as i navigate away from that screen and return it goes blank.
if i try and have a button on another screen to Set(vardate,now()) it also updates the card however it does not update the values as once i navigate away from that screen and return it is blank as well
Leaving the default to thisitem.date for the datacard and manually using the datepicker and dropdowns to time work as expected.
I am making a little progress but not using the button. I can set the default of the card to
and it retains the date values for the picker and dropdowns when changing screens.
Still unsure of what appears to be a simple task to update a date/time card with a now button. And further thought it should be able to update it if the card its populated or not.
One button click to set date time is much easier than 4 button clicks to set datepicker, time and minute.
I've used your button to change date. When used the button also changes colour and text. How do you do to make the button keep this colour and text? Now the button changes back to original colour and text the next time you open the app.
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
Learn how to build the business apps that you need.