Page 1 of 1

which stage to use

Posted: Tue Aug 14, 2007 11:57 am
by prasad111
Hi All,
This is one of the requirement, need help

Code: Select all

Input data

col1|col2

M|abc
C|def
U|hji
M|ad
U|ryer
M|fntry
C|rtf
U|gsfdg


Ouput 
col1|col2|col3 |col4|col5|col6

M|abc|C|def|U|hji
M|ad|	|	|U|ryer
M|fntry|C|rtf|U|gsfdg
whenever an M starts the data has to be entered in a new row.

Regards
Prasad

Re: which stage to use

Posted: Tue Aug 14, 2007 1:13 pm
by meena
Hi Prasad,
If col1 values are consistent( 'M','C' & 'U').

Use the transformer stage to filter the col1 using constarints and to get three output streams.Define a common dummy column in all three outstreams with the same constant value.Next use the merge stage to merge all the three streams.
Or you can do the same using filter,modify and merge stages.

Code: Select all

Input data

col1|col2

M|abc
C|def
U|hji
M|ad
U|ryer
M|fntry
C|rtf
U|gsfdg


Ouput 
col1|col2|col3 |col4|col5|col6

M|abc|C|def|U|hji
M|ad|	|	|U|ryer
M|fntry|C|rtf|U|gsfdg
[/quote]

Re: which stage to use

Posted: Tue Aug 14, 2007 1:55 pm
by prasad111
meena wrote:Hi Prasad,
If col1 values are consistent( 'M','C' & 'U').

Use the transformer stage to filter the col1 using constarints and to get three output streams.Define a common dummy column in all three outstreams with the same constant value.Next use the merge stage to merge all the three streams.
Or you can do the same using filter,modify and merge stages.

Code: Select all

Input data

col1|col2

M|abc
C|def
U|hji
M|ad
U|ryer
M|fntry
C|rtf
U|gsfdg


Ouput 
col1|col2|col3 |col4|col5|col6

M|abc|C|def|U|hji
M|ad|	|	|U|ryer
M|fntry|C|rtf|U|gsfdg
[/quote]

As you can see in the sample data shown M, C and U are not consistent, there might be
M and C, or
M and U or
M, C and U present.
As they are not consistent I guess we cannot use merge stage to merge the data.

Re: which stage to use

Posted: Tue Aug 14, 2007 5:15 pm
by vijayrc
prasad111 wrote:
meena wrote:Hi Prasad,
If col1 values are consistent( 'M','C' & 'U').

Use the transformer stage to filter the col1 using constarints and to get three output streams.Define a common dummy column in all three outstreams with the same constant value.Next use the merge stage to merge all the three streams.
Or you can do the same using filter,modify and merge stages.

Code: Select all

Input data

col1|col2

M|abc
C|def
U|hji
M|ad
U|ryer
M|fntry
C|rtf
U|gsfdg


Ouput 
col1|col2|col3 |col4|col5|col6

M|abc|C|def|U|hji
M|ad|	|	|U|ryer
M|fntry|C|rtf|U|gsfdg
As you can see in the sample data shown M, C and U are not consistent, there might be
M and C, or
M and U or
M, C and U present.
As they are not consistent I guess we cannot use merge stage to merge the data.[/quote]

A transformer will do the trick...You know at the sight of 'M' a new row is to be written...If you encounter a C or an U after a M, you can hold them in stage variable and write this row when you encounter the next 'M'
Helps ?? or confusing ??

Re: which stage to use

Posted: Tue Aug 14, 2007 5:16 pm
by vijayrc
prasad111 wrote:
meena wrote:Hi Prasad,
If col1 values are consistent( 'M','C' & 'U').

Use the transformer stage to filter the col1 using constarints and to get three output streams.Define a common dummy column in all three outstreams with the same constant value.Next use the merge stage to merge all the three streams.
Or you can do the same using filter,modify and merge stages.

Code: Select all

Input data

col1|col2

M|abc
C|def
U|hji
M|ad
U|ryer
M|fntry
C|rtf
U|gsfdg


Ouput 
col1|col2|col3 |col4|col5|col6

M|abc|C|def|U|hji
M|ad|	|	|U|ryer
M|fntry|C|rtf|U|gsfdg
As you can see in the sample data shown M, C and U are not consistent, there might be
M and C, or
M and U or
M, C and U present.
As they are not consistent I guess we cannot use merge stage to merge the data.[/quote]

A transformer will do the trick...You know at the sight of 'M' a new row is to be written...If you encounter a C or an U after a M, you can hold them in stage variable and write this row when you encounter the next 'M'
Helps ?? or confusing ??

Posted: Tue Aug 14, 2007 5:26 pm
by us1aslam1us
Follow this link and see whether that can move you in a proper direction:

viewtopic.php?t=99149&postdays=0&postor ... ge&start=0

sAM

Posted: Thu Aug 16, 2007 1:54 pm
by prasad111
vijayrc and us1aslam1us reply was very helpful.

Thanks a lot.............