cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LyonsBI_BRL
Helper III
Helper III

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

@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
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,726)