cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Champion
Community Champion

Re: Update Timestamp Datacard to Now() Upon Submit?

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.

View solution in original post

Highlighted
Community Champion
Community Champion

Re: Update Timestamp Datacard to Now() Upon Submit?

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

Highlighted
Microsoft
Microsoft

Re: Update Timestamp Datacard to Now() Upon Submit?

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
Highlighted
Community Champion
Community Champion

Re: Update Timestamp Datacard to Now() Upon Submit?

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.

View solution in original post

Highlighted
Community Champion
Community Champion

Re: Update Timestamp Datacard to Now() Upon Submit?

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

Highlighted
Microsoft
Microsoft

Re: Update Timestamp Datacard to Now() Upon Submit?

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

Highlighted
Helper II
Helper II

Re: Update Timestamp Datacard to Now() Upon Submit?

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

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,609)