cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BHR
Helper II
Helper II

auto increment value on button click on powerapps screen

Hi All,

I need to implement auto sequence number with 4 digits of button onselect on powerapps screen which i need to patch in dataverse table. This sequence number should be maintained for all users. Can someone help suggest me on this criteria.

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
PG_WorXz10
Resident Rockstar
Resident Rockstar

Hi @BHR ,

 

Try below formula to get the incremented value. 

 

Set(varAutonum,Sum(Value(First(SortByColumns(DataSourceName,"YourIDColumnName",Descending)).YourIDColumnName),1))

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

View solution in original post

8 REPLIES 8
PG_WorXz10
Resident Rockstar
Resident Rockstar

Hi @BHR ,

 

In dataverse there is autonumber field which can be 4 digit and auto incrementing. Are you referring to this or you want something else ? 

 

 

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Hi @PG_WorXz10 ,

 

Thanks for helping me.

 

I want to generate autonumber on powerapps screen itself on button click.

For ex: I have a new form which is opened by clicking on add icon when we click on add icon we need to generate autonumber which we need to show on form text input.

 

 

Vikas_Sharma
Frequent Visitor

Hello @BHR 

For this you need to maintain a column in dataverse and in power apps you can use function to get that value and add 1 there and set that in a variable to  show it  like: Set(variableName,Value(Last(databaseName).ColumnName +1));

Try with this hope this will work for you.

 

shivam38
Advocate I
Advocate I

Hey @BHR  if you want to use autoincrement number you can refer to this formula:- 

set(variable name ,value(Last(database name).'Column name '+1)).

it will automatically increase last id with one but in the initial you need to give a value so that from next time it can automatically calculate values.

PG_WorXz10
Resident Rockstar
Resident Rockstar

Hi @BHR ,

 

Just want to be sure before I suggest any formula to calculate auto number. 

In case two are three users open the form same time click on add the Autonumber which uses Dataverse unique ID will be same for those three users considering it will require time to submit those data into Dataverse after adding all the required fields. 

 

I would suggest its always better to show the autonumber after the data is patched which will make it unique for all the users otherwise there are slight chances of creating same unique number for multiple users.

 

 

 

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Hi @Vikas_Sharma ,

Thanks for helping me.

 

i have created dataverse column in table and which is starting with 1000. i used the Concatenate(varName,"-",Text(varAutonum)). but it was not taking latest number while patching.

it was showing like AAA-1.

Please help me.

PG_WorXz10
Resident Rockstar
Resident Rockstar

Hi @BHR ,

 

Try below formula to get the incremented value. 

 

Set(varAutonum,Sum(Value(First(SortByColumns(DataSourceName,"YourIDColumnName",Descending)).YourIDColumnName),1))

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Vikas_Sharma
Frequent Visitor

Hi @BHR 

First Check, what value you are getting in your varAutonum variable. 

If you are fetching value from table for varAutonum variable then use Text(Last(databaseName).ColumnName);

Try with this hope this will work for you.

 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,577)