Padding numbers for Custom Serial Number

Padding numbers for Custom Serial Number

  

Hello all,


Need some help with making a custom serial number of form XX12345678, where XX are alphabets.

Currently I am thinking of using two different entity attributes to hold XX and 12345678 separately, and then display them side by side when needed to form the custom serial number. Is there a more efficient way of doing this?

Also, I saw here that one can pad numbers (https://www.outsystems.com/forums/discussion/31668/custom-id-number/)

Could someone point me in the right direction to find the required functions or steps to do so?


Thank you for your kind help.

Hi qwerty,


Do you want to want to store serial number(alphanumeric) with primary key? if not give me more info.


note: You can create text attribute as a primary key in Outsystems.

-Sudhakar

Hi qwerty,

You can do one thing create your own user Action and generate this number based on your logic and assign it to that record or other way is First create the record after creating that record use the output id and append custom serial number into it and call Update entity action to update that record. Because same i did for one of my project.




-Hitesh

Hi,


To achieve that, you need to first set the starting value to some place. 


I.e. in database, or in function, or in site properties etc..  

Once you have that, you can custom logic to generate your particular next serial number. 

Now you need to again save that number so that you can get it next time when you will again increment it with one and use it. And this cycle continues each time you create new serial number. 


Please check attached OML file which is generating exactly same thing which you required. 


It will generate something like this.

Regards,

Palak Patel

Sudhakar Duraisamy wrote:

Hi qwerty,


Do you want to want to store serial number(alphanumeric) with primary key? if not give me more info.


note: You can create text attribute as a primary key in Outsystems.

-Sudhakar

Hi Sudhakar,


I'm quite new to databases and stuff so I don't really get what is a primary key?

However from what I've read from wikipedia the existing EntityId would act as a key yes? I just need to create a unique serial number for each new entry.


Cheers

Hitesh Maran wrote:

Hi qwerty,

You can do one thing create your own user Action and generate this number based on your logic and assign it to that record or other way is First create the record after creating that record use the output id and append custom serial number into it and call Update entity action to update that record. Because same i did for one of my project.




-Hitesh


Hello Hitesh,

 

Thank you for this. This looks like what I am trying to do. 


I will be testing it out later, but won't the IdtoInt() function result in integers that go 1,2,3, ... ? Would you know how to make the output 0000 0001, 0000 0002,... ?


Palak Patel wrote:

Hi,


To achieve that, you need to first set the starting value to some place. 


I.e. in database, or in function, or in site properties etc..  

Once you have that, you can custom logic to generate your particular next serial number. 

Now you need to again save that number so that you can get it next time when you will again increment it with one and use it. And this cycle continues each time you create new serial number. 


Please check attached OML file which is generating exactly same thing which you required. 


It will generate something like this.

Regards,

Palak Patel

Ohh this looks somewhat like what I'm trying to create! The oml file is processing upload though so I can't really see what wonderful things are under the hood in that output :/


qwerty wrote:

Palak Patel wrote:

Hi,


To achieve that, you need to first set the starting value to some place. 


I.e. in database, or in function, or in site properties etc..  

Once you have that, you can custom logic to generate your particular next serial number. 

Now you need to again save that number so that you can get it next time when you will again increment it with one and use it. And this cycle continues each time you create new serial number. 


Please check attached OML file which is generating exactly same thing which you required. 


It will generate something like this.

Regards,

Palak Patel

Ohh this looks somewhat like what I'm trying to create! The oml file is processing upload though so I can't really see what wonderful things are under the hood in that output :/


I don't know why its still processing to upload the file.
Let me try again to attach. 


Hi,
Might be some issues with the file uploading service.

You can download the OML file from following temporary location.  
https://tmpfiles.org/download/11698/SerialNumbers.oml

Regards,
Palak