One Star

[resolved] tOracleOutput and "Empty table" option

Hi,
I'm working on Talend job that should sometimes empty a table before initializing it, but sometimes should only update or create data without emptying it.
More precisely, my input is an XML file that, once 'flatten', sometimes looks like :
AAA;111;I
BBB;222;I
CCC;333;I
...
'I' is for initialization : the table should be empty and everything should be replaced.
But sometimes it looks like :
DDD;444;C
EEE;555;S
FFF;666;M
'C' for creation, 'M' for modification and 'S' for suppression (delete).
My job takes the XML file, flatten it and, through a tMap with four outputs (depending on I, M, C and S), redirects rows to independently configured tOracleOutputs.
My 'I' output is linked to a tOracleOutput with "Empty table" option.
Other outputs 'classicaly' go to tOracleOutput with 'create', 'update' and 'delete' options (but without 'Empty table' option).
Here is a screenshot of my job :

In this screenshot, you can see 2 rows in my 'C' (creation) output, and 0 row in my 'I' output (component detail showing 'Empty table'/'Vider la table' option).
The thing is : even if there no rows with 'I' options, my table is always emptied. It seems that the tOracleOuput ALWAYS empty the table even if there no rows on it.
You can understand that after that, my creations, modifications and deletions are done on an empty table, and that's not what I want to implement.
Is there a way of blocking this 'Empty table' action if there no row on my 'Initialisation' output ?
Hope the description of my problem is clear enough.
Thanks for your help.
Roland SAIKALI.
1 ACCEPTED SOLUTION

Accepted Solutions
One Star

Re: [resolved] tOracleOutput and "Empty table" option

Thanks Shong, it's resolving the bad effect.
But my table is now emptied on each iteration...
I'm now looking for a way I can know I'm on the first iteration to empty my table only once...
4 REPLIES
Community Manager

Re: [resolved] tOracleOutput and "Empty table" option

Hi
on 'I' flow, just add a tFlowToItearate+tFixedFlowInput between tMap and Oracle, eg:
.....tMap---main---tFlowToIterate---iterate---tFixedFlowInput---main--tOracleOutput
on tFixedFlowInput, generate the current flow
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] tOracleOutput and "Empty table" option

Thanks Shong, it's resolving the bad effect.
But my table is now emptied on each iteration...
I'm now looking for a way I can know I'm on the first iteration to empty my table only once...
One Star

Re: [resolved] tOracleOutput and "Empty table" option

As I think I can't guess if I'm on the first iteration or not, I will need to review my job design.
Initialisations will go first in a tempfile. If no lines (no initialisations), treat other cases. Else empty table and insert everything...
Still working on it... but I found my first approach prettier (even if it's not working) ;-)
Thanks for your help again.
Community Manager

Re: [resolved] tOracleOutput and "Empty table" option

Hi
But my table is now emptied on each iteration...

oh... I have overlooked this point. As you done, writing result to a temp file is a solution.
Best regards
Shog
----------------------------------------------------------
Talend | Data Agility for Modern Business