cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Veronica
Level 8

Autogenerate a number

Regards

 

I need to generate a sequential number however this number must be concatenated by a prefix according to the type of law choose by a dropdown by the user and the sequences are individual for each region. For example: OPM2018-001 because the type is OPM but I can have in another region/office that same number because its sequences are individual for each region. I use office365User.Myprofile().OfficeLocation and save it in a global variable.  I have a Type table.  

 

Any ideas will be appreciate.

 

veronica

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: Autogenerate a number

Hi @Veronica,

 

What do you mean by "Type" table? From your formula I understand that you have an Office365 Users connection in this app, but is this Type table another data source? If so, please tell what is this connector. 

 

My understanding so far is that you need the number to be like:

Dropdown1.Selected.Value+"-00X"

 

If so, then you just need to follow below steps:

1. Set below formula in the OnVisible property of the screen:

 

Set(Test1,"001");Set(Test2,"001");Set(Test3,"001")

 

 

2. Set below formula in the OnSelect property of a button control:

 

If(Dropdown1.Selected.Value="OPM",UpdateContext({Test1:Test1+1},Dropdown1.Selected.Value="XX",UpdateContext({Test2:Test2+1},Dropdown1.Selected.Value="XXX",UpdateContext({Test3:Test3+1}))

 

 

3. Set below formula on the Text field of the label control that you want to show the required number:

 

If(Dropdown1.Selected.Value="OPM",Concatenate("OPM",Test1),Dropdown1.Selected.Value="XX",Concatenate("XX",Test2),Dropdown1.Selected.Value="XXX",Concatenate("XXX",Test3))

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Veronica
Level 8

Re: Autogenerate a number

I used a Carlos Figueira blog in Generate Inventory Number and change it a little bit, I need it to use the right function intead of the mid function he use. This is only part of the solution. Then I had to Concatenate with other part of the final number. Then I used Mona's 3 step. Text( Value( Right( First( Sort( Filter('[dbo].[Detalle]',StartsWith(vOfficeLocation,Oficina)&&(vTipo=Valortipo)),vNumeroPeticion,Descending).vNumeroPeticion).vNumeroPeticion,3)+1,""))

View solution in original post

6 REPLIES 6
Community Support Team
Community Support Team

Re: Autogenerate a number

Hi @Veronica,

 

What do you mean by "Type" table? From your formula I understand that you have an Office365 Users connection in this app, but is this Type table another data source? If so, please tell what is this connector. 

 

My understanding so far is that you need the number to be like:

Dropdown1.Selected.Value+"-00X"

 

If so, then you just need to follow below steps:

1. Set below formula in the OnVisible property of the screen:

 

Set(Test1,"001");Set(Test2,"001");Set(Test3,"001")

 

 

2. Set below formula in the OnSelect property of a button control:

 

If(Dropdown1.Selected.Value="OPM",UpdateContext({Test1:Test1+1},Dropdown1.Selected.Value="XX",UpdateContext({Test2:Test2+1},Dropdown1.Selected.Value="XXX",UpdateContext({Test3:Test3+1}))

 

 

3. Set below formula on the Text field of the label control that you want to show the required number:

 

If(Dropdown1.Selected.Value="OPM",Concatenate("OPM",Test1),Dropdown1.Selected.Value="XX",Concatenate("XX",Test2),Dropdown1.Selected.Value="XXX",Concatenate("XXX",Test3))

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Super User
Super User

Re: Autogenerate a number

Hey @Veronica

 

 

You could put that logic in a Flow and then send it back to your app.

In Flow you can do more things like generating a number with a prefix and so on.

You could set some variables and then with compose or other data operations you could do your magic.

 

Hope this helps

 

Kind regards

 

 

Tom





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Veronica
Level 8

Re: Autogenerate a number

Hi,

 

Thank you very much for your recomendation and your time.  I work in Courts.  Type table is a support table that has the type of law or issue the user is going to record on my app.  Like a wedding, Law125, Law246, etc .  The autogenerate number should be a combination of the prefix of the law-year-number for example (OPM-2018-025).  Its like a case number, but the complication is that each court  has their own sequence.  The table that has all the records with all the information is call Detail table. So I dont know what function to use in order to go to Detail table, evaluate the court of the user, look in Detail table the last number for that court(user's court) and increment +1. 

 

Vero 

Veronica
Level 8

Re: Autogenerate a number

Thank you for your time, Tom.  I am trying not to use Flow because my MS partner told me that I have a limitation in Flow license.  Also, I don't know much only the basic basic of Flow.  

 

Thanks,

 

Veronica

Veronica
Level 8

Re: Autogenerate a number

Finally I did it. Thanks all for your help. veronica
Veronica
Level 8

Re: Autogenerate a number

I used a Carlos Figueira blog in Generate Inventory Number and change it a little bit, I need it to use the right function intead of the mid function he use. This is only part of the solution. Then I had to Concatenate with other part of the final number. Then I used Mona's 3 step. Text( Value( Right( First( Sort( Filter('[dbo].[Detalle]',StartsWith(vOfficeLocation,Oficina)&&(vTipo=Valortipo)),vNumeroPeticion,Descending).vNumeroPeticion).vNumeroPeticion,3)+1,""))

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 442 members 5,309 guests
Please welcome our newest community members: