Hi
I have just noticed that a datetime column that is being submitted with the current time - Now() was not being updated with the timestamp. The Updated attribute of the column is set to Now(). Subsequent submits use the time from the first submit.
This seems to have started after UTC 2020-06-01 06:00:00 after examining my data.
I believe this to be a bug and should only take 5 minutes to reproduce.
To reproduce the problem:-
1. create a sharepoint list and add one column that is a date with time column.
2. create the default app over the sharepoint list.
3. change the Update attribute of the datetime datacard in the default app's EditForm1 to Now()
Run the app and add a record - the first one works. Submitting more new records leaves the datetime as the first submitted.
I'm using SQL Server, and the same thing is happening there.
I hope you can help.
Robyn
Solved! Go to Solution.
Hi
instead of using a timer, another simpler workaround to the bug is:-
On the Submit button of your form screen, capture the timestamp:-
UpdateContext({timestamp: Text(Now(),"yyyy-mm-dd hh:mm:ss.sss")});
SubmitForm(EditForm1)
On the Update attribute of your datetime datacard include:-
DateTimeValue(timestamp)
Adjust accordingly if saving as UTC, or if you don't want to update if doing an EditForm and not a NewForm.
Cheers
I had faced this issue once for SQL server, then I believe I captured the datetime stamp at the SQL level, instead of capturing at Power Apps.
Cheers!
Vivek
Hi @RobynPr :
Firstly,let me explain why you encount this problem.
The point is Now and Today are volatile functions. Each time one of these functions is evaluated it returns a different value.
When used in a data flow formula, a volatile function will only return a different value if the formula in which it appears is reevaluated. If nothing else changes in the formula then it will have the same value throughout the execution of your app.
For example, a label control with Label1.Text = Now() will not change while your app is active. Only closing and reopening the app will result in a new value.
Secondly,Instead of using Now() in the Default property set the Default to use the value of a variable. Then in the timerEnd property of the timer set the value of Now().
For example:
1\Set the OnStart property to:
Set(Var,Now()) /*Var is my custom variable*/
2\Add a timer:
Duration:
5000 /*loop in 5 s*/
AutoStart:
true
Repeat:
true
OnTimerEnd:
Set(Var,Now()) /*Var is my custom variable*/
Visible:
false
Best Regards,
Bof
Thanks for your reply.
So shouldn't a reevaluation be done on SubmitForm or ResetForm?
If PowerApps is meant to be low/no code and you have to include timers and the like to simply put a timestamp on a submitted record, this is contrary to the principles of the product.
Also, it seems that this behaviour has changed from June 1, 2020 as my App has been around for some time without this problem.
I hope the two points I make are considered.
Thanks
Hi @RobynPr :
I think your opinion makes sense.
If you want PowerApp to make improvements in this regard,I suggest you post your ideas to the following forum:
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas
At present, in order to make your app work properly, I suggest you to modify it according to the scheme I provided.
Best Regards,
Bof
Hi
And to the point about the behaviour changing on 1 June 2020?
Thanks
Hi
instead of using a timer, another simpler workaround to the bug is:-
On the Submit button of your form screen, capture the timestamp:-
UpdateContext({timestamp: Text(Now(),"yyyy-mm-dd hh:mm:ss.sss")});
SubmitForm(EditForm1)
On the Update attribute of your datetime datacard include:-
DateTimeValue(timestamp)
Adjust accordingly if saving as UTC, or if you don't want to update if doing an EditForm and not a NewForm.
Cheers
Hi @RobynPr :
Wonderful idea!
I suggest you mark this idea as a solution so that more people can see it.
Best Regards,
Bof
I have the timer implemented on the main screen of my app, and I want to use that updated time variable on other screens. I see the timer variable doesn't update when i'm on another screen. Is there a way for the timer to keep running while on another screen?
I put a hidden timer on each screen. And it is working. Consider this closed.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
198 | |
172 | |
62 | |
33 | |
32 |
User | Count |
---|---|
338 | |
271 | |
105 | |
71 | |
56 |