cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

Update Timestamp Datacard to Now() Upon Submit?

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.  

3 ACCEPTED SOLUTIONS

Accepted Solutions
Super User II
Super User II

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.


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.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Super User III
Super User III

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.

View solution in original post

Community Support
Community Support

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

View solution in original post

4 REPLIES 4
Super User II
Super User II

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.


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.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Super User III
Super User III

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.

View solution in original post

Community Support
Community Support

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

View solution in original post

Thank you @KrishnaV , @eka24 , and @v-bofeng-msft for your help!  

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (7,583)