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

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

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
Thuberdeau
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)

Dual Super User
Dual Super User

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (4,910)