[size=150:2fwlc9mk][b:2fwlc9mk]SEQUENCES
[/b:2fwlc9mk][/size:2fwlc9mk]
Often we need to generate sequential ID/numbers for various documents and they should be unique. There can be sereral ways, but this is the one I personally advise.
This example accommodates upto 1-1/2 million numbers in each series and makes an ID with width of 6 characters.
This sample sample involves creation of a `sequences` table for 3 series 'IN', 'PO', 'VR' and a function to retrieve the next sequence value of any of these series. The sequence number is converted into 36-base number to reduced width requirements.
Anyone interested may run this code:
[code=fw:2fwlc9mk][/code:2fwlc9mk]
Once ready with this table and function, retrieving next sequence number is very easy:
Eg:
? oCn:NextSerial( 'IN' )
? oCn:NextSerial( 'VR' )
↧