Page 1 of 1

Retain loop variable value in a transformer?

Posted: Tue Jun 07, 2011 5:21 pm
by mctny
Hi,

I have a question, I need to store the last value of a loop variable so that I can use it in the output link ( or in the new loop) in a column for the other rows. The output link has a constraint which filter the row for which the loop variable is calculated.

Loop value is reset to its initial value each for each row and I can not save it to access for the next row. can I store it at the last iteration for the first row so that I can access it processing for the next row?

Thanks in advance

Posted: Mon Jun 18, 2012 4:19 am
by Karthik.M
This is simple in DataStage 8.5.

A new utility function "SaveInputRecord" is available in Transformer stage which can be mapped with the loop variable and the output link can be mapped to another utility function "GetSavedInputRecord".

Posted: Mon Jun 18, 2012 5:21 am
by ray.wurlod
That would be a much more useful reply had you elaborated on how to achieve the "with the loop variable" part.

It seems to me that a straightforward approach would be to use stage variables to "remember" the value from the previous record, perhaps using the DCount() function to establish the number of elements.