Page 1 of 1

Posted: Wed Jul 07, 2010 12:51 am
by ray.wurlod
I cannot discern any generalizable logic that would produce the desired output. Can you please provide a written rule (or set of rules)? In particular I don't understand how the final two rows in your example, especially the penultimate one, are obtained.

Posted: Wed Jul 07, 2010 1:25 am
by ArndW
So the logic is:
(a) If the first column is NULL, then use the value from the previous row's first column instead of the NULL.
(b) If the second column is NULL; then use the value from the current row's first column instead of the NULL.

If that is correct, then use 2 stage variables as follows:

Code: Select all

svNewColumnValue       IF IsNull(In.NewColumn) THEN svLastNewColumnValue ELSE In.NewColumn
svLastNewColumnValue     In.NewColumn
svOldColumnValue      IF IsNull(In.OldColumn THEN svNewColumnValue ELSE In.OldColumn
Derive NewColumn from svNewColumnValue and OldColumn from svOldColumnValue.