Hi.
I have this data which at present has sequence numbers which are not in order due to some data records failing to migrate to target due to validation failure, and later on passing through after being suitably corrected.
Now I first of all sort the data on the basis of a key and the timestamp of the creation of the data record to get a proper logical sequence.
Now, how can I assign the appropriate sequence numbers to each record, considering that for a given key, there can be multiple data, and I am grouping the data on the basis of the key value.
So if I have key value as A, and corresponding records as 4 in number, so they should be logically numbered as 1-4, and for another key value B with corresponding records as 5 in number, the logical numbering should be 1-5.
Considering that both groups of records are in the same dataset, can anyone suggest as to how I can achieve this logical numbering?
How to assign sequence numbers to sorted data ?
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 43
- Joined: Mon Jan 15, 2007 10:53 pm
How to assign sequence numbers to sorted data ?
Regards,
Vivek D. Reddy
__________________________________________
If knowledge can create problems, it is not through ignorance that we can solve them. - Isaac Asimov
Vivek D. Reddy
__________________________________________
If knowledge can create problems, it is not through ignorance that we can solve them. - Isaac Asimov
Hope you are using Sort stage for sorting the data in the order. User "Create Key Change column" option in the Sort stage which will enable you additional field.
This will assign 1 to each new group.
User Transformer stage to store the previous record in a stage variable and add 1 till you find the current record as 1.
This will assign 1 to each new group.
User Transformer stage to store the previous record in a stage variable and add 1 till you find the current record as 1.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Hope you are using Sort stage for sorting the data in the order. User "Create Key Change column" option in the Sort stage which will enable you additional field.
This will assign 1 to each new group.
User Transformer stage to store the previous record in a stage variable and add 1 till you find the current record as 1.
This will assign 1 to each new group.
User Transformer stage to store the previous record in a stage variable and add 1 till you find the current record as 1.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Hope you are using Sort stage for sorting the data in the order. User "Create Key Change column" option in the Sort stage which will enable you additional field.
This will assign 1 to each new group.
User Transformer stage to store the previous record in a stage variable and add 1 till you find the current record as 1.
This will assign 1 to each new group.
User Transformer stage to store the previous record in a stage variable and add 1 till you find the current record as 1.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
-
- Participant
- Posts: 43
- Joined: Mon Jan 15, 2007 10:53 pm
I am sorry, but could you please elaborate as to how I may store a previous value in a stage variable, and then use it for comparison?
Regards,
Vivek D. Reddy
__________________________________________
If knowledge can create problems, it is not through ignorance that we can solve them. - Isaac Asimov
Vivek D. Reddy
__________________________________________
If knowledge can create problems, it is not through ignorance that we can solve them. - Isaac Asimov
Use stage variable in Transformer,
Assing Counter to a Field.
Oh sorry, just now I notices that the post has been repeated.
Code: Select all
Intial Assignment vPreKey = 1
Counter => If Input.ChangeKeyColumn = 0 Then PreKey + 1 Else 0
vPreKey = Counter
Oh sorry, just now I notices that the post has been repeated.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Too difficult.
Just add a Column Generator, operating sequentially, downstream of the Sort stage (which presumably was also operating sequentially, or use a Sort Merge collector if not).
Use a Cycle with an increment of 1.
Just add a Column Generator, operating sequentially, downstream of the Sort stage (which presumably was also operating sequentially, or use a Sort Merge collector if not).
Use a Cycle with an increment of 1.
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.