Page 1 of 1

Compare Next Value before insert into target

Posted: Mon Oct 22, 2007 10:35 am
by jhaggas
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.

Posted: Mon Oct 22, 2007 1:50 pm
by ray.wurlod
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.

Re: Compare Next Value before insert into target

Posted: Fri Oct 26, 2007 12:39 am
by sanath1234
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.
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.

Re: Compare Next Value before insert into target

Posted: Tue Aug 26, 2008 1:38 pm
by deepthi
What is the maxium value that this key_mgt transform generates upto?
Will it resets after the number is reached?

Thanks
Deepthi

sanath1234 wrote:
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.
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.

Re: Compare Next Value before insert into target

Posted: Tue Aug 26, 2008 3:04 pm
by ray.wurlod
deepthi wrote:What is the maxium value that this key_mgt transform generates upto?
Will it resets after the number is reached?

Thanks
Deepthi
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.