Is there anyway to compare the next value in a transformer before doing a insert?
I am sorting data by three columns and comparing the previous values of each row to perform various summary activites, but need a way to tell the transformer only to insert the last one. If I had a way to compare the next value with the current value I could do it that way or if there is a way to know when I get the last value for a sort key row I could only insert the last one.
Your thoughts or ideas would be appreciated. Thanks.
Compare Next Value before insert into target
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Not directly. There's no lookahead capability within the flow in DataStage.
You can use stage variables in a Transformer stage to detect the first record in a group, then sort by the group keys then by that value in descending order, and then detect when that"key change column" was 1 in the previous row in a downstream Transformer. In that case you are at the last record in the group, so you could use the value to constrain the output.
You can use stage variables in a Transformer stage to detect the first record in a group, then sort by the group keys then by that value in descending order, and then detect when that"key change column" was 1 in the previous row in a downstream Transformer. In that case you are at the last record in the group, so you could use the value to constrain the output.
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.
-
- Participant
- Posts: 24
- Joined: Wed Oct 17, 2007 1:28 am
- Location: hyderabad
Re: Compare Next Value before insert into target
by useing stage variables in transformer ucan do it in stage variables u have to store the curr_next_val which u generated by key mgt tramsform.jhaggas wrote:Is there anyway to compare the next value in a transformer before doing a insert?
I am sorting data by three columns and comparing the previous values of each row to perform various summary activites, but need a way to tell the transformer only to insert the last one. If I had a way to compare the next value with the current value I could do it that way or if there is a way to know when I get the last value for a sort key row I could only insert the last one.
Your thoughts or ideas would be appreciated. Thanks.
ETL=DS
Re: Compare Next Value before insert into target
What is the maxium value that this key_mgt transform generates upto?
Will it resets after the number is reached?
Thanks
Deepthi
Will it resets after the number is reached?
Thanks
Deepthi
sanath1234 wrote:by useing stage variables in transformer ucan do it in stage variables u have to store the curr_next_val which u generated by key mgt tramsform.jhaggas wrote:Is there anyway to compare the next value in a transformer before doing a insert?
I am sorting data by three columns and comparing the previous values of each row to perform various summary activites, but need a way to tell the transformer only to insert the last one. If I had a way to compare the next value with the current value I could do it that way or if there is a way to know when I get the last value for a sort key row I could only insert the last one.
Your thoughts or ideas would be appreciated. Thanks.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: Compare Next Value before insert into target
No practical limit, and it does not reset. The engineering limit depends on the precision setting, but you can always get at least a fifteen digit number.deepthi wrote:What is the maxium value that this key_mgt transform generates upto?
Will it resets after the number is reached?
Thanks
Deepthi
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.