Page 1 of 1

concatenate all the output rows in a variable

Posted: Mon Feb 12, 2007 7:35 am
by parvathi
hi all,
i have requirement to concatenate all the input records and then only pass it as a single record in to the sequential file.How can i do this?

Posted: Mon Feb 12, 2007 7:44 am
by DSguru2B
Define a stage varialbe say "stgVar" with derivation "stgVar:in.Col". Your output link will have one column defined with the above stage variable as its derivation. The last row will be what you want. You can get that by, either passing it through the aggregator, or doing a tail -1 on the file.
While reading the records, read it as a single value by specifying 000 as delimiter and specifying only one column.

What do you intent to do? The record is going to be one HUGE record.

Posted: Mon Feb 12, 2007 12:20 pm
by narasimha
What is the source of these records?
The answer can vary with file and database.

Posted: Mon Feb 12, 2007 12:40 pm
by I_Server_Whale
Why not the "Row Merger" Stage?

Posted: Mon Feb 12, 2007 2:22 pm
by ray.wurlod
Do you really mean all the records, or all the columns? Or one column from all the records? Do you want them delimited, or simply concatenated?

There are many possible solutions, depending upon exact requirements. Most, if not all, will involve one or more stage variables.

Posted: Tue Feb 13, 2007 1:00 am
by parvathi
I have three columns in one row which are concatenated and there are 5 records which are concatenated with or. Iwas able to concatenate.
the soure is an an OCI stage

The problem is when i don't have any input any records A NULL STRING IS BEING PROCESSED instead OF THE NULL STRING i want to pass a value of 1=2

Posted: Tue Feb 13, 2007 1:07 am
by narasimha
What approach are you using to concatenating the columns?
You can check if the input is not null then pass the value, else pass something else.(1, 2 or whatever you want)

Posted: Tue Feb 13, 2007 1:52 am
by kumar_s
Is it like you are processing some kind of where class to another database or a script file or something?
After concatenation, check for IsNull(), and assign the required default value.

Posted: Tue Feb 13, 2007 2:36 am
by parvathi
kumar_s wrote:Is it like you are processing some kind of where class to another database or a script file or something?
After concatenation, check for IsNull(), and assign the required default value.
yes what you said was exactly right.
I have used IsNull() condition but i observed is that once there are records in the input oracle source the transformer stage is not processed at all .Is it reaaly happens like that

When there are no records in the OCI stage the stage varible in the transformer should have a different value .I have tried all the means . BUt the value which i want is never written

Posted: Tue Feb 13, 2007 2:49 am
by kumar_s
hi Parvathi,

Sorry, I couldn't get what you exactly mean here.
Do you mean to say, the records are getting reject at transformer or not passing after this stage?
If so check the constraints and metadata options for nullable. If you see the statistics in the input link of the tranformer, and if there is not constraints and and with compatable input/output metadata, rows should be passed to output.
You can explain, more on what are you doing in tranformer, with the condition mentioned.

Posted: Tue Feb 13, 2007 7:43 am
by DSguru2B
If your table is empty then Yes, no records will pass through. You need to incorporate the IsNull() check within the database stage. And send a single row.