Sequence number
Moderators: chulett, rschirm, roy
Sequence number
hi all,
I'm in need to generate sequential number based on the follwing criteria.
If my record starts with '6' then i got to generate the number starting from '01' and If the record starts with some other number then it should be one.
Here the main criteria is the records starting with '6' wont be in order. I mean the records with other than '6' will also be in middle.At that time the sequence number should be genrated from the previous value being generated.
For example.
Input --> Sequence number
623 then 01
640 then 02
590 then 01
875 then 01
634 then 03
627 then 04
Could any one suggest me how to generate the same.
Your time will highly appreciated.
Thanks in advance,
Veera
I'm in need to generate sequential number based on the follwing criteria.
If my record starts with '6' then i got to generate the number starting from '01' and If the record starts with some other number then it should be one.
Here the main criteria is the records starting with '6' wont be in order. I mean the records with other than '6' will also be in middle.At that time the sequence number should be genrated from the previous value being generated.
For example.
Input --> Sequence number
623 then 01
640 then 02
590 then 01
875 then 01
634 then 03
627 then 04
Could any one suggest me how to generate the same.
Your time will highly appreciated.
Thanks in advance,
Veera
Have two stage variable namely svInd and svCnt.
Derivation for svInd
I had assumed that the input is a string.
Derivation for svCnt
In your output column derivation have the following code:
You need not sort data.
Derivation for svInd
Code: Select all
If InRec.Col1[1,1]=6 then @TRUE else @FALSE
Derivation for svCnt
Code: Select all
If svInd then svCnt + 1 else svCnt
Code: Select all
If svInd then svCnt else 1
Nit pick alert!
You do not need to specifically set an expression to "true" or "false", that is automatic when it is evaluated. So rather than the derivation posted for svInd, it can simply be:
FYI.
You do not need to specifically set an expression to "true" or "false", that is automatic when it is evaluated. So rather than the derivation posted for svInd, it can simply be:
Code: Select all
InRec.Col1[1,1]=6
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Use the Fmt() function to add leading zeroes. Beware, however, that this will give "strange" results if your count goes over the number of digits you specify in your format string.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I am sorry.It is not fair to post premium content.veera24 wrote:As i don't have the membership i couldn't see chulett's comment. So could you pls. help me out to get to know.balajisr wrote:Thanks Craig for your useful alert.
Thanks in advance,
Veera
Why don't you buy premium membership. Certainly worth it.
Hi,balajisr wrote:I am sorry.It is not fair to post premium content.veera24 wrote:As i don't have the membership i couldn't see chulett's comment. So could you pls. help me out to get to know.balajisr wrote:Thanks Craig for your useful alert.
Thanks in advance,
Veera
Why don't you buy premium membership. Certainly worth it.
Its ok at the least you can guide me right?instead posting Chulett's comments.
Thanks,
veera