Page 1 of 1

transform rows to columns end record value to null

Posted: Mon Apr 02, 2007 6:45 am
by rhaddur
Dear Gurus please guid me on the following

source ----- - ------- Target
Cust Id ----- -------- Cust Id1 ,Cust Id2
1 ---------------------- 1 , 2
2 ----------------------3 , 4
3 ---------XFM ------- 5 , 6
4 ---------------------- 7, Null
5
6
7


I have above source table with different cust Id , I want target with to subsequent cust id as pair

If the job reach end of the record it shuold padd null as shown above

Please guid me on the same
Thanx in Advance

Posted: Mon Apr 02, 2007 8:54 am
by ray.wurlod
Your requirement is not clear. Your words and your example do not match.

Please document the algorithm by which 1 generates 1,2; 2 generates 3,4; 3 generates 4,6 (note that 4 is repeated); 4 generates 7,NULL and 5,6 and 7 do not generate anything.

It would appear (if the result for 3 is a typo, and should be 5,6) that the two values can be generated using:
2 * @INROWNUM -1
2 * @INROWNUM

But you would need to know in advance what the highest key value in the file is, so as to know when to stop generating values. This could be obtained, for example, using tail -1 filename and processing that result.

Each derivation of the second column would need to check that the expression has not generated a larger value, and a constraint expression would need to be used to specify when to stop generating output rows.

Posted: Mon Apr 02, 2007 8:55 am
by ganesh123
I guess you have confused the gurus. So no replies...

Use "code" and then specify properly what you need. Then we may understand clearly what you want. :?

Posted: Mon Apr 02, 2007 8:58 am
by ray.wurlod
Only the ones without an RMM stage. :wink:

Posted: Tue Apr 03, 2007 12:30 am
by rhaddur
ray.wurlod wrote:Your requirement is not clear. Your words and your example do not match.

Please document the algorithm by which 1 generates 1,2; 2 generates 3,4; 3 generates 4,6 (note that 4 is repeated); 4 gener ...

Please check the currected

Posted: Tue Apr 03, 2007 6:42 am
by ray.wurlod
Where?

Posted: Tue Apr 03, 2007 6:42 am
by ray.wurlod
Where?

Posted: Wed Apr 04, 2007 5:16 pm
by Madhusv
This can acomplished by using transformer stagevariable -> "Previous value" property and sorting data if required. Logic is to save the count of records processed and increment the count and split the records into 2 different streams.

In server job you can do this with out any additional settings.
In Prallel job you to restrict the job to 1 node (Sequential run).

Posted: Thu Apr 05, 2007 9:53 am
by DSguru2B
I say, use stage variables and keep concatenating the inputs. Use field() function to parse the fields you require. Your output will be a single column. Other way that I can think of is by using awk.