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

Quantity Change Buttons

I've been working on an inventory app, and I've encountered a small item I need help tweaking.

Bvandyke22_0-1605616521766.png

 

The quantity box Stays blank until you start using the arrows, then it starts at 0 and counts up or down. The save button will only submit what the up or down buttons have input. So if i push up 4 times, the number in the box would be 4, but if I type 9 then hit save, 4 is what would be saved. My code is below.

 

Quantity Text Box= Default : currentQuantityValue

Up Arrow= OnSelect: UpdateContext({currentQuantityValue:currentQuantityValue+1})

Down Arrow= Onselect: UpdateContext({currentQuantityValue:currentQuantityValue-1})

Save Button= OnSelect: 

Patch(PadPartsList, Gallery1_1.Selected, {Quantity:currentQuantityValue});

ResetForm(Form1_1);

Navigate(EPList)

Form Text Box:

Bvandyke22_1-1605616925022.pngBvandyke22_2-1605616958984.png

Bvandyke22_3-1605617059889.png

 

Any Tips would be greatly appreciated. I'm sure It's something about how I have the variable assigned or something. But I'm stumped at the moment.

 

3 REPLIES 3
RandyHayes
Super User
Super User

@Bvandyke22 

Don't reference the variable in your patch, reference the textinput control.

Patch(PadPartsList, 
    Gallery1_1.Selected, 
    {Quantity: Value(yourQuantityTextboxName.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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

When I tried that, the Up and Down buttons no longer work and the patch function does not update the quantity at all.

 

I did try changing the control on the up and down buttons from UpdateContext({currentQuantityValue:currentQuantityValue-1}) to UpdateContext({TextInput3.Text:currentQuantityValue-1}) and also UpdateContext({currentQuantityValue:TextInput3.Text-1}) with no luck.

ganeshsanap
Memorable Member
Memorable Member

@Bvandyke22 

Set OnChange property of your text input control to:

 

UpdateContext({ currentQuantityValue: TextInput3.Text })

 


Please click Accept as solution if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

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

Users online (1,634)