I have a simple form with a hidden timestamp datacard which I want to set to Now() when the user clicks a Submit button. I do not want to set the default value for the datacard to Now() as I want to capture the timestamp at the exact time of submit. The data is added to a SQL database. Is there a way to fill the timestamp datacard on the form with the value of Now() and then add the record to the database in the same step? I'm struggling because PowerApps has taken my timestamp record and broken out into date, hours, and minutes fields when I added the datacard.
Solved! Go to Solution.
Hi @JimSutt ,
Yes it is the case with Now() on to a label, I assume you are doing sumitform(formname), dot the same with a patch as below:
Patch(sqltable,default(sqltable),{column1:value1,........,timestamp:now()});
This will get the live timestamp.
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.
Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.
Do you want to get the exact time of submit.
On the OnSelect of the Submit button Set a variable:
Set(varTimenow, Now ()); SubmitForm (YourFormName)
Or
For time only
Set(varTimenow, Text(Now (),h"mm:ss")); SubmitForm (YourFormName)
Then put the variable name: varTimenow into the Default of the Datacarvalue.
------------
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.
Hi @JimSutt :
Firstly,thanks to @eka24 and @KrishnaV for providing solutions. If their solution solves your problem, I suggest you mark one or all of the responses as solutions, so that more people can see it.
Secondly,let me explain why you encounted this prolem.
The point is Now is a volatile function. Each time one of these functions is evaluated it returns a different value.
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.
When used in a behavior formula, volatile functions will be evaluated each time the behavior formula is evaluated. See below for an example.
Best Regards,
Bof
Hi @JimSutt ,
Yes it is the case with Now() on to a label, I assume you are doing sumitform(formname), dot the same with a patch as below:
Patch(sqltable,default(sqltable),{column1:value1,........,timestamp:now()});
This will get the live timestamp.
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.
Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.
Do you want to get the exact time of submit.
On the OnSelect of the Submit button Set a variable:
Set(varTimenow, Now ()); SubmitForm (YourFormName)
Or
For time only
Set(varTimenow, Text(Now (),h"mm:ss")); SubmitForm (YourFormName)
Then put the variable name: varTimenow into the Default of the Datacarvalue.
------------
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.
Hi @JimSutt :
Firstly,thanks to @eka24 and @KrishnaV for providing solutions. If their solution solves your problem, I suggest you mark one or all of the responses as solutions, so that more people can see it.
Secondly,let me explain why you encounted this prolem.
The point is Now is a volatile function. Each time one of these functions is evaluated it returns a different value.
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.
When used in a behavior formula, volatile functions will be evaluated each time the behavior formula is evaluated. See below for an example.
Best Regards,
Bof
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
186 | |
52 | |
50 | |
34 | |
33 |
User | Count |
---|---|
267 | |
97 | |
84 | |
72 | |
71 |