cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Thuberdeau
Frequent Visitor

Updating multiple time fields with independent buttons

Hi there.

 

I am trying to build an App where the user has the option of pushing a 5 seperate buttons to update a time stamp in 5 seperate text fields and ultimatly a Sharepoint list. Problem i'm having is after making the first button / text field work with this formula:

 

Button on select: UpdateContext({DateNow: Now()})

text field default: If(IsBlank(DateNow), ThisItem.'Stop Time', DateNow)

 

I try to emulate this formula on the other buttons but the first button seems to update all other text fields. Meaning the buttons are not independant of each other. I click any of them and it updates ALL 5 text fields.

 

What am I doing wrong?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

Make sure when you replicate the formula for the other buttons that you change the name of the variable you are updating.  So if Button 1 uses 

UpdateContext({DateNow: Now()})

Then Button 2 should use

UpdateContext({DateNow2: Now()})

Similarly each text field should depend on the value of a different context variable.  Text Box 1 would be

If(IsBlank(DateNow), ThisItem.'Stop Time', DateNow)

And Text box 2 would be

If(IsBlank(DateNow), ThisItem.'Stop Time', DateNow2)

Repeat the pattern for all the remaining buttons and textboxes.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
Pstork1
Dual Super User III
Dual Super User III

Make sure when you replicate the formula for the other buttons that you change the name of the variable you are updating.  So if Button 1 uses 

UpdateContext({DateNow: Now()})

Then Button 2 should use

UpdateContext({DateNow2: Now()})

Similarly each text field should depend on the value of a different context variable.  Text Box 1 would be

If(IsBlank(DateNow), ThisItem.'Stop Time', DateNow)

And Text box 2 would be

If(IsBlank(DateNow), ThisItem.'Stop Time', DateNow2)

Repeat the pattern for all the remaining buttons and textboxes.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Just to clarify I had to add the sequencing "2" to both "Datenow" commands.

 

If(IsBlank(DateNow2), ThisItem.'Stop Time', DateNow2)

Pstork1
Dual Super User III
Dual Super User III

Sorry, yes good catch.  You need to use a unique variable name for each pair of buttons and textboxes. Otherwise when you change the variable it will affect multiple text boxes.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,306)