cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Corissandageri
Responsive Resident
Responsive Resident

Increment number with button

Hi all

I have done a search on this but the variants I came across vary slightly on what I want.

I have a text box where I enter a purchase order number e.g 350223. Often I enter consecutive orders. How would I have a button that would add one to the order number that I manually entered?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@Corissandageri 

Use this code in the OnSelect property of your button

Set(myPurchaseOrderNum, Value(TextInput1.Text) + 1);
Set(myPurchaseOrderReset, true);
Set(myPurchaseOrderReset, false);

 

Put this code in the Default property of your text input

myPurchaseOrderNum

 

And also this code in the Reset property of the text input.

myPurchaseOrderReset

 

Now when you click the button it will increment the number you input automatically.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

6 REPLIES 6
eka24
Super User
Super User

Watch this auto increment by Shane Young
https://youtu.be/plKw_xfVfwY?t=450

 

 

mdevaney
Super User
Super User

@Corissandageri 

Use this code in the OnSelect property of your button

Set(myPurchaseOrderNum, Value(TextInput1.Text) + 1);
Set(myPurchaseOrderReset, true);
Set(myPurchaseOrderReset, false);

 

Put this code in the Default property of your text input

myPurchaseOrderNum

 

And also this code in the Reset property of the text input.

myPurchaseOrderReset

 

Now when you click the button it will increment the number you input automatically.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

TheRobRush
Super User
Super User

in the onselect of the button

Set(orderval,value(textinput1.text)); ///textinput1 is name of wherever you type an order number.
Set(orderval, orderval+1);
reset(textinput1)

Then in the default of textinput1 make the value orderval, and in onstart of app add Set(orderval,0) so that starts as 0

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Thank you

This works great, I understand the Set(myPurchaseOrderNum, Value(TextInput1.Text) + 1);

But don't really understand the resets. 

@Corissandgeri
Once you have types a value into the Text Input it no longer shows the Default value. By resetting the control we clear the value you wrote in and replace it with the default value (previous value + 1)

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

Thank for that explanation

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.

Top Kudoed Authors
Users online (1,459)