cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ram3
Microsoft
Microsoft

Capture timestamp using OnCheck Property but keep it constant

Hello,

I was able to capture timestamp for a Boolean switch using OnCheck property. However, the time changes whenever screen changes. I want the time to be captured on initial change and stay constant without changing again as long as the OnCheck property is on.

 Screenshot 2022-01-12 133355.jpg

11 REPLIES 11
RandyHayes
Super User
Super User

@Ram3 

What you are showing should provide what you want.

Once that context variable is set, it will retain that value until it is set again.

 

So, either the toggle is getting unchecked and rechecked or you are setting that context variable some place else.

 

I would take a look at the variable viewer and see if you are setting it someplace else in the screen.

If nothing from that exploration...then what is the Default property of the toggle?

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes , thank you for your quick response.

 

OnCheck property:

Ram3_0-1642024412992.png

I do have visible property on the Actions Completed and Completion time which depend on whether first toggle is selected or not. In the picture, the second row doesn't show the values unless the condition is toggled to true first.

Do you think this is interfering with the time being updated?

RandyHayes
Super User
Super User

@Ram3 

That should have no impact on the situation.  

Anything on the Default property of that toggle?

Also, check through your Variable Viewer and see if there is any place else that you might be setting that variable.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Ram3
Microsoft
Microsoft

The default value is set to a Variable. That variable is used for the oncheck property for the toggle.

 

Default:

Ram3_0-1642025306772.png

Visible property for the datacard:

Ram3_2-1642025453714.png

 

OnCheck and OnUncheck for toggle:

Ram3_1-1642025348399.png

 

What is a Variable Viewer? Is it somewhere where we can see all its properties?

RandyHayes
Super User
Super User

@Ram3 

The Default property for the Toggle is what I was looking for.  Not the TextInput control.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Ram3
Microsoft
Microsoft

Datacard default:

Ram3_0-1642026106693.png

 

Toggle Default:

Ram3_1-1642026132767.png

 

RandyHayes
Super User
Super User

@Ram3 

Ah, there we go!!

You say you are leaving this screen and then coming back and it is changed.  

There is most likely your issue as you are indeed changing the Default of the toggle, which means if it goes false and then true again (which it will do based on what you showed) then it will reset the time.

 

NOW, before we explore that, you might want to just cut to a quick solution.  That would be to change your OnCheck formula to the following:

If(IsBlank(datetime), UpdateContext({datetime, Now()}))

This would make it so that if there is already a value in the variable...it will not do anything.  Uncheck would blank it and then it can be set again.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Ram3
Microsoft
Microsoft

This didn't fix it. I still see the time being updated continuously.  I changed this at 3:06 but after couple of minutes, it is showing as 3:08

Ram3_0-1642028951299.png

 

RandyHayes
Super User
Super User

@Ram3 

Actually, the more I thought about that...the less I liked it.  Because, if it is going unchecked, then it is blanking it out and thus the condition was not relevant.

 

So...let's explore.  Can you explain more about the going away from the screen and coming back?  You mentioned this was the initial issue.  (of course now, you are saying that it just happens as you watch it)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,156)