cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

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
Highlighted
Community Support
Community Support

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

Highlighted
Resolver I
Resolver I

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
Highlighted
Community Support
Community Support

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

Highlighted
Memorable Member
Memorable Member

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



If this reply has answered your question or solved your issue, please mark this question as answered.

Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

Highlighted
Resolver I
Resolver I

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 

Highlighted
Resolver I
Resolver I

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

Highlighted
Resolver I
Resolver I

Re: Autogenerate a number

Finally I did it. Thanks all for your help. veronica
Highlighted
Resolver I
Resolver I

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,179)