cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Corissandageri
Post Patron
Post Patron

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."

View solution in original post

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (1,576)