This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - How to generate customized Sequence No

krish80 - Thursday, February 19, 2009 6:17 AM:

I want to create the sequence no is like  :  abc1001xyz , in that (abc) is input of one field of same form (Textbox / dropdown box) & (xyz) is also input of another field of same form. My question is how to generate this no and how to save this into same form TABLE.

 

 



mbeaulieu - Thursday, February 26, 2009 1:03 PM:

This can be done by putting the three properties on the form.  One for the user entered prefix, one for the user entered suffix and one for the actual combination of the prefix,suffix and sequence.  You would then create a server event on this itemtype using the onBeforeAdd or onbeforeUpdate depending on if you only wanted this to happen on the first save or on every update.

The method would need to concatenate the prefix, next sequence and suffix and populate the your unique number property.

You could also do this on the client side as well but since I dont really know what your business requirements are, this is a good starting point

The code might look something like

dim

pr as string = me.getProperty("prefix") ' assuming your property name is prefix

dim

sf as string = me.getProperty("suffix") ' assuming your property name is suffix

Dim

myi As innovator = Me.newInnovator()

Dim

seq As String = myi.getNextSequence("mysequence") ' assuming your sequence name is mysequence

Dim

num As String = pr + seq + sf

Me

.setProperty("mynumber",num)