Page 1 of 1

Complex logic

Posted: Wed Jun 27, 2007 12:37 am
by umamahes
I have an input file

Posted: Wed Jun 27, 2007 12:54 am
by ArndW
This complex logic is too much for me. Could you please explain the rules in text as well?

Re: Complex logic

Posted: Wed Jun 27, 2007 1:17 am
by JeroenDmt
You can use a stage variable in a transformer to hold the parent value.
If you define the stagevariable svParent as:

Code: Select all

if IsNull(indata.Col1) then indata.Col2 else svParent
The value of this variable will change if a new parent record is found, and stay the same if child records are found.

Then you can use this stage variable to load the first column in the output.

Posted: Wed Jun 27, 2007 1:21 am
by JoshGeorge
Also add the constraint NOT(IsNull(indata.Col1)) in transformer :)

Posted: Wed Jun 27, 2007 1:36 am
by JeroenDmt
JoshGeorge wrote:Also add the constraint NOT(IsNull(indata.Col1)) in transformer :)
Oops, yes, that would be useful too :)

Posted: Wed Jun 27, 2007 4:58 am
by ray.wurlod
Is this multi-level? Would you need to generate complete hierarchies, such as 1 2 3 4 5 6 ? That would add a deal of complexity (recursion), but could be solve using a carefully-designed hashed file and the little-known WITHIN query.