cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

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

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

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

 

 

Highlighted
Super User III
Super User III

@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

Highlighted
Helper V
Helper V

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

Highlighted

Thank you

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

But don't really understand the resets. 

Highlighted

@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.
Highlighted

Thank for that explanation

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,022)