how to add an empty row

One Star

how to add an empty row

hi,
i have input data as
acctid acctno status
-----------------------
1 IS1234 A
2 IS1234 A
3 BS1234 A
4 BS1234 A
5 IS129 A
I want data as
acctid acctno status
-----------------------
1 IS1234 A
2 IS1234 A
3 BS1234 A
4 BS1234 A
5 IS129 A
new empty row created after new account no exists. so, to differentiate between account nos, we need to insert a new empty row.
how to do this?
pls reply.
One Star

Re: how to add an empty row

Hi
Here is a screnario which may help you.
Use tLoop to iterate each row of input file and insert into target file.
The aim of tJavaRow is to compare current acctno column with previous row.
If they are different, set context.flag as true and trigger run-if to insert an empty row.
The following job is just an example. You'd better change it to fit your requirment.
Regards,
Pedro
One Star

Re: how to add an empty row

hi,
thanks, it works fine.
but i have job as tmap--->toracleoutput, i dont want tloop and tfileoutputdelimit append in my jobs.
is there any way to do this with out these components?
One Star

Re: how to add an empty row

Hi
You can use tOracleOutput instead of tFileDelimited.
But i want to say your requirment is a little special.
Oracle is relational database. Inserting an empty row into Oracle is abnormal.
Why do you want that?
Regards,
Pedro
One Star

Re: how to add an empty row

my job looks as

tmap--->toracleoutput
on sub jobok
toracleinput--->tfileoutputdelimit
in output file i want to insert empty rows .
but in example, you implement with tfileinputdelimit, tloop.
here how to implement them? I want to read data from toracleinput and insert empty rows into tfileoutputdelimit.
how to read one row at a time from toracleinput
how we can give the "to" value for tloop component with out hardcoding? I mean i have to give number of rows of toracleinput.
One Star

Re: how to add an empty row

Hi
There is an easy workaround.
Save all records in Oracle table into a temp delimited file.
You can't read rows one by one from DB. Because the performance will be awful.
Regards,
Pedro
One Star

Re: how to add an empty row

Hello,
Where and how are you defining the second images context.flag and context.line?
I am new with Talend, I am trying to replay this example but I can't find where to define it.
thks for your response
valery
One Star

Re: how to add an empty row

Hi Valery
Click on "Contexts" tag and you will find a "+" button.
Regards,
Pedro
One Star

Re: how to add an empty row

thks a lot and excuse me for thi simple question but it's not obvious when you start with the product.
thks
Valery
One Star

Re: how to add an empty row

thanks,

i will try this.