Page 1 of 1

How this Row Splitter works

Posted: Thu Jul 29, 2004 3:45 pm
by New2DS
Hi All,

How does the row splitter stage work and what for is it used. I thought it will split one row into multiple columns but not able to split the rows I guess I am doing something wrong. In the stage input it will ask for the name of the row which we want to split and in the output columns some how if I add an extra column the job is getting aborted.

I have gone through the documention but it is very brief and not able to understand how to use this stage.

Can we split more than one column at a time? How do we define the output columns in the satge.



thanks,

Posted: Thu Jul 29, 2004 6:34 pm
by rasi
Row Splitter works same like the sequential stage expect it reads the data from a link. This is to split a input column into multiple columns. For example if you have a column say reject_column which holds all the information into one single string then this string can be splitted into multiple columns based on the meta data.

I don't think we can split more than one column in a link.

Thanks
Siva

Posted: Fri Jul 30, 2004 10:29 am
by New2DS
Thanks for the reply.

Still I am not able to split the column through this stage I don't know whats wrong am I doing.


I have the job design like this

Code: Select all

seq-->trn-->rowSplitter-->Seq
       |
       V
      hash
Input Seq is a .CSV file with input columns ( c1 char(12), c2 char(12), c3 char(4)). How can I split the column C1 into three equal columns as R1,R2 and R3 and I need the rest of the columns C2,C3 into the target seq file. What should be my metadata for the output R1,R2 and R3 is it like Char(4) each?

thanks

Posted: Sat Jul 31, 2004 4:49 am
by vmcburney
Take out the rowsplitter, it's doing nothing for your job. You can do what you want to do in the transformer through standard string handling commands in the derivation columns.

You three output columns will be set to:
input.C1[1, 4]
input.C1[5, 4]
input.C1[9, 4]

This splits C1 into three fields that are sent to the output sequential file.

You current design, a link writing to a row merge writing to a sequential file, is like writing to two sequential files in a row. The row merge changes the metadata description of a row, you read in a record with a small number of fields and you get out of it a large number of fields. Columns that retain the same name on input and output of the stage are not changed, other columns are split according to the field lengths.

Posted: Mon Aug 02, 2004 3:20 pm
by rcil
Hi All,

Does the row splitter splits the rows into columns based on the delimeter? If not how do we split a single string without any delimiter into two columns using this stage.

I tried like this in the input I have Id char(12) and in the output I defined as two columns with char(6) each but it doesn't work.When I tried using the delimiter it worked

Hope I will get helped in understanding this stage.

thanks

Posted: Mon Aug 02, 2004 10:33 pm
by ray.wurlod
No. The row splitter "decatenates" based on the contents of a column. It does have the ability to generate multiple rows.
There is a separate manual (splitter.pdf) that describes this stage type. The Row Splitter stage can only have one output link.

Posted: Mon Aug 02, 2004 10:46 pm
by vmcburney
Let me repeat what I said in the earlier reply. If you are only splitting a small number of columns there is no reason to use the rowsplitter stage, instead you can do this split in a transformer.

To split a field input.custcode char 10 into two fields:

"145634FRED"
input.custcode[1, 6] -> "145634"
input.custcode[7,4] -> "FRED"

Map each of these to an output field in your transformer and you have turned one field into two where the first six characters go down one path and the last four go down the other path.

If you have a delimited string do the following:
"145634,FRED"
FIELD(input.custcode, ',', 1) -> "145634"
FIELD(input.custcode, ',', 2) -> "FRED"

The field command retrieves a string from a delimited text string.

So when should you use the rowsplitter? When you have a large number of fields, say more then 6, and writing a FIELD or character array command for every output field is time consuming and difficult to maintain. You should also find that splitting the field in a transformer is faster then splitting it in the rowsplitter.

I use the rowmerge and rowsplitter stages when I do change data comparisons using the CRC32 function when I need to turn a record with a lot of columns into a single text string or vice versa.

hi

Posted: Sat Sep 22, 2007 10:29 pm
by udaysindu
u can use the Pivot stage for columns into rows.

hi

Posted: Sun Sep 23, 2007 7:28 am
by chulett
U can? Does he know that?

ps. Your time would be better spent in threads that aren't three years old. :roll:

Posted: Thu Sep 27, 2007 10:34 pm
by baglasumit21
New2DS wrote:Thanks for the reply.

Still I am not able to split the column through this stage I don't know whats wrong am I doing.


I have the job design like this

Code: Select all

seq-->trn-->rowSplitter-->Seq
       |
       V
      hash
Input Seq is a .CSV file with input columns ( c1 char(12), c2 char(12), c3 char(4)). How can I split the column C1 into three equal columns as R1,R2 and R3 and I need the rest of the columns C2,C3 into the target seq file. What should be my metadata for the output R1,R2 and R3 is it like Char(4) each?

thanks
As per my knowledge, the column to be splited should be the last column. So if you want to split the column C1 you need to rearange the cloumns as ( c2 char(12), c3 char(4),c1 char(12)). Try doing it this way

Posted: Thu Sep 27, 2007 10:52 pm
by Raghavendra
You are replying to a post posted on Jul 30, 2004 .