cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Dual Super User III
Dual Super User III

Re: Updating multiple time fields with independent buttons

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
Highlighted
Dual Super User III
Dual Super User III

Re: Updating multiple time fields with independent buttons

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

Highlighted
Frequent Visitor

Re: Updating multiple time fields with independent buttons

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

 

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

Highlighted
Dual Super User III
Dual Super User III

Re: Updating multiple time fields with independent buttons

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,140)