cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LyonsBI_BRL
Resolver I
Resolver I

OnChange Label is not updating when value changes

Got a good one this morning which I thought was already solved. 

I have a label that shows the number of days an item has been in inventory.

The Default is set to as shown below, for calculating the number of Days since the item was checked in

DateDiff(ThisItem.CheckInDate,Today())

LyonsBI_BRL_0-1620405036573.png

However on the OnChange, whenever the value changes, it's not posting back to the DB. I'm sure its something I'm overlooking here. Any help would be appreciated. 

Patch('Customers',ThisItem,{CountDays:NumberofDays.Text})

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @LyonsBI_BRL,

Based on the issue that you mentioned, do you want to update the CountDays based on the Text input on change?

Could you please share a bit more about the scenario?

Your formula is completely correct, this should work if the OnChange fires.

Actually, the OnChange property will be triggered only when the user clicks on anywhere of the screen, and not as soon as the condition is met.

OnChange – How the app responds when the user changes the value of a control (for example, by adjusting a slider).

This is how our official doc defines the OnChange property.

I have make a test for you, please check as below.

Reset.gif

You could see that you need to click other place within the Screen to trigger to OnChange property.

As an alternative solution, please consider inset a submit button to trigger the Patch().

Insert a button into the Gallery, set the OnSelect as below:

Patch('Customers',ThisItem,{CountDays:NumberofDays.Text})

Regards,

Qi

Best Regards,
Qi

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@LyonsBI_BRL 

Please consider changing your Formula to the following:

UpdateIf('Customers',ID = ThisItem.ID, {CountDays:NumberofDays.Text})

If your CountDays column is a numeric column, then change to:

UpdateIf('Customers',ID = ThisItem.ID, {CountDays: Value(NumberofDays.Text)})

 

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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
v-qiaqi-msft
Community Support
Community Support

Hi @LyonsBI_BRL,

Based on the issue that you mentioned, do you want to update the CountDays based on the Text input on change?

Could you please share a bit more about the scenario?

Your formula is completely correct, this should work if the OnChange fires.

Actually, the OnChange property will be triggered only when the user clicks on anywhere of the screen, and not as soon as the condition is met.

OnChange – How the app responds when the user changes the value of a control (for example, by adjusting a slider).

This is how our official doc defines the OnChange property.

I have make a test for you, please check as below.

Reset.gif

You could see that you need to click other place within the Screen to trigger to OnChange property.

As an alternative solution, please consider inset a submit button to trigger the Patch().

Insert a button into the Gallery, set the OnSelect as below:

Patch('Customers',ThisItem,{CountDays:NumberofDays.Text})

Regards,

Qi

Best Regards,
Qi

View solution in original post

@v-qiaqi-msft yeah I figured that one out 😀

 

Thanks!

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 (1,942)