Page 1 of 1
row merger
Posted: Wed Apr 16, 2008 3:16 pm
by just4u_sharath
i have data IN A SEQUENTIAL FILE LIKE
1|2|3
4|5|6
7|8|9
Now i want to convert this data to 123456789 in a single row.
My job is sequentilal file----->row merger----->sequential file
When i run the job by selecting MULTIPLE LINES my ouput file looks like
1|2|3
4|5|6
7|8|9 (when i checke in output sequential file)
But the output link frin rowmerger gives a count of 1, but still i am able to see 3 rows in output. What is this behaviour. And also if i wnat to concatenate only two columns in each row, how can i do this. What kind of derivaations can i use in Derivation field of Row Merger
Re: row merger
Posted: Wed Apr 16, 2008 3:30 pm
by just4u_sharath
just4u_sharath wrote:i have data IN A SEQUENTIAL FILE LIKE
1|2|3
4|5|6
7|8|9
Now i want to convert this data to 123456789 in a single row.
My job is sequentilal file----->row merger----->sequential file
When i run the job by selecting MULTIPLE LINES my ouput file looks like
1|2|3
4|5|6
7|8|9 (when i checke in output sequential file)
But the output link frin rowmerger gives a count of 1, but still i am able to see 3 rows in output. What is this behaviour. And also if i wnat to concatenate only two columns in each row, how can i do this. What kind of derivaations can i use in Derivation field of Row Merger
I got rid of delimiters.
Nou my output data looks like 1|2|34|5|67|8|9. How can i get rid of these pipe delimiters in output
Posted: Wed Apr 16, 2008 4:53 pm
by ray.wurlod
What do you want to replace them with? Use a Convert() function.
Posted: Thu Apr 17, 2008 1:05 am
by ganesh.soundar
ray.wurlod wrote:What do you want to replace them with? Use a Convert() function. ...
Use the below code to remove the pipeline symbol
Convert('|','',<FieldName>)
Posted: Thu Apr 17, 2008 2:22 am
by sachin1
hello just4u_sharath
i am facing the same problem, i am seeing 3 rows in output, but i want them to be in single rows like 123456789 for input
1;2;3
4;5;6
7;8;9
i see
1;2;3
4;5;6
7;8;9 in output.
can you please help.
Posted: Thu Apr 17, 2008 3:12 am
by ray.wurlod
Use a stage variable to accumulate via concatenation and constrain the transformer stage to emit output only every third row.
Posted: Thu Apr 17, 2008 3:23 am
by sachin1
Hello Ray is it not possible with row merger stage.
Posted: Thu Apr 17, 2008 4:26 am
by ray.wurlod
Neither is Convert(). I thought you may be considering other stage types. Can you post how you are attempting to merge the rows with the Row Merger stage?
Posted: Thu Apr 17, 2008 5:51 am
by DS_FocusGroup
if i concatinate all three input columns in a StageVar= col1:col2:col3
and then put this constraint in the transformer Mod(@INROWNUM,3)=0, it will just give me every third row and in this care 789 ? but we need 123456789 ? no ? what if we have more than three rows ? say a thousand ?
Posted: Sun Apr 20, 2008 1:49 pm
by savis
Hi,
I used the following design:
seq file ---- transformer-----seq file
My input was like
1|2|3
4|5|6
7|8|9
11|12|13
14|15|16
17|18|19
In the first seq file,
I didn't not specify any end delimiter or field delimiter.
In Transformer,
I used two stage variables for doing this task.
Ist stage variable:(stagevar)
If Mod(@INROWNUM,3) =1 Then DSLink2.INPUT Else If Mod(@INROWNUM,3) =2 Then StageVar:DSLink2.INPUT Else StageVar:DSLink2.INPUT
2nd stage variable:(stagevar1)
Convert("|","", StageVar)
OUTPUT:
123456789
111213141516171819
Hope this helps...
Thanks,
savis