cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WeAllStardust
Helper I
Helper I

Updating Label or Text input with button and math

Hello community,

 

I have a Button that patches a SharePoint List. The button looks at a checkbox and a text input and sees if it checked. If it is, it will deduct the quantity from a label. My issue is that the label does not update when it is executed. 

 

 

 

If(
    Checkbox1.Value = true,
    Value(Input1.Text) = (Value(Input2.Text)) - Value(1.Text)
);

 

 

 

The label has a value of 150 in its Text property. As the user types a quantity and checks the box, I need it to update this label. 

I tried it with a Text Input instead but it does not update. What am I doing wrong?

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @WeAllStardust,

Do you want to sub the number within the Text input control based on the number within the Label?

Could you please tell me how you set the Text property of the quantity Label?

 

I assume that you want to click the button to update the quantity within the label when you check the Checkbox and input a number within the TextInput control, right?

Actually, if the quantity number from the Label is captured from the SP list, you should use the Patch() function to update the quantity label as below:

If(
    Checkbox1.Value = true,
    Patch(SPList,
                <Here is the formula how you set the quantity Label Text property>,
                  {Quantity:Value(QuantityLabel.Text)-Value(InputNumber_TextInput.Text)}
          )
);
Best Regards,
Qi

View solution in original post

2 REPLIES 2
v-qiaqi-msft
Community Support
Community Support

Hi @WeAllStardust,

Do you want to sub the number within the Text input control based on the number within the Label?

Could you please tell me how you set the Text property of the quantity Label?

 

I assume that you want to click the button to update the quantity within the label when you check the Checkbox and input a number within the TextInput control, right?

Actually, if the quantity number from the Label is captured from the SP list, you should use the Patch() function to update the quantity label as below:

If(
    Checkbox1.Value = true,
    Patch(SPList,
                <Here is the formula how you set the quantity Label Text property>,
                  {Quantity:Value(QuantityLabel.Text)-Value(InputNumber_TextInput.Text)}
          )
);
Best Regards,
Qi

Sorry for the late response but the label's default value is "150". I wanted to start with a number and then deduct with it. The number will never increase, only decrease. Would it be easier to make a list and add that number to it or to hardcode it into the app? Below is a snap shot of the screen. The label with the "150" is on another screen. 

 

Screenshot 2022-06-28 093659.jpg

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,624)