One Star

tmap reload at each row

Hi,
I've a list of customers whith a numeric field called "matric". My goal is this: when I find an input record with the same value of "matric" (for example 15) I need to add 1000 and to remember the new value (1015) so that if an other customer come with the value of matric 15 I can add 1000 to the latest value (1015) obtaining 2015 and so on.
To store the values I made a delimited file with 2 fields: the original matric and the latest value used.
I put this file once in input as lookup and once in output and I checked "reload at each row".
But it seems not to reload
I upload the tmap.
The Var.matcon contains this:
Relational.ISNULL(matr_IN.matric_original)
?
out1.matric.trim()
:
String.valueOf(matr_IN.matric_last_used+1000)

Many thanks!
Flav
9 REPLIES
One Star

Re: tmap reload at each row

Sorry,
I made a big mistake!
To store the values I can't use a file (because I've to do insert o updates).
Now I've replaced the file with an Access table and I put the "commit" after every operation of insert/delete
And it works!!!
(with DataStage I used hash files and I never thought that I need a DB Table with commit=1)
Bye!
Flav
One Star

Re: tmap reload at each row

Hello,
While I insert rows in a tOracleOutput, I need to update an identificator field (ID_VALUE) of this componenet with the last value of it plus 1 (ID_VALUE = MAX(ID_VALUE) +1).
Please, any idea of how can I do this. I'm using a t_map.
Thanks a lot,
Gracia.
Community Manager

Re: tmap reload at each row

Hello
Before inserting each row into db, query the max value of ID_VALUE column and store it global var.
Please see my screenshots.
Just one point, do you consider using a oracle sequence for identificator field (ID_VALUE)?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tmap reload at each row

Hello
Before inserting each row into db, query the max value of ID_VALUE column and store it global var.
Please see my screenshots.
Just one point, do you consider using a oracle sequence for identificator field (ID_VALUE)?
Best regards
Shong

Hello Shong,
thanks for your help.
Yes I've consider to use an oracle sequence, but I don't Know how to implement it with Talend inside my job.
Gracia.
One Star

Re: tmap reload at each row

Shong,
what do you use for tRowGenerator, tFlowToIterate and tFixedFlowInput. I'm using directly tOracleInput, tMap (where I define the variable) and tOracleOutput.
Thanks again,
Gracia.
Community Manager

Re: tmap reload at each row

Hello
About oracle sequence in Talend, you can see 1488.
I use tRowGenerator to generate some test data and use tFlowToIterate to iterate each row, see 5827.

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tmap reload at each row

OK, perfect. Thank you very much.
Now, I've got a problem with my tFixedFlowInput. I describe below my job (more or less):
tOracleInput ------> tJavaRow ----> tFixedFlow --------------> tMap ---------> tOracleOutput
row1 row2
When I run the job, it send the next Java Error:
java.lang.NullPointerException
at integracion.copy_of_integracion_b_0_1.Copy_of_Integracion_b.tFixedFlowInput_1Process(Copy_of_Integracion_b.java:3899)
The line refers to the next code:
row2.ID_USUARIO = (Integer) globalMap.get("row1.ID_USUARIO");
Any idea of the problem?.
Thanks a lot,
Gracia.
Community Manager

Re: tmap reload at each row

Hello
Is there a column called ID_USUARIO on tOracleInput component? please show me the whole error message printed on console.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tmap reload at each row

Hello
Is there a column called ID_USUARIO on tOracleInput component? please show me the whole error message printed on console.
Best regards
Shong

Hello Shong,
yes, there is a column called ID_USUARIO on tOracleInput component. It catches the next value
"SELECT MAX(EFLU_ADMIN.EFLU_USUARIOS.ID_USUARIO) +1
FROM EFLU_ADMIN.EFLU_USUARIOS"
Here below, I've typed the complete error:
Exception in component tFixedFlowInput_1
java.lang.NullPointerException
at integracion.copy_of_integracion_b_0_1.Copy_of_Integracion_b.tFixedFlowInput_1Process(Copy_of_Integracion_b.java:3953)
at integracion.copy_of_integracion_b_0_1.Copy_of_Integracion_b.tOracleInput_6Process(Copy_of_Integracion_b.java:613)
at integracion.copy_of_integracion_b_0_1.Copy_of_Integracion_b.runJobInTOS(Copy_of_Integracion_b.java:10694)
at integracion.copy_of_integracion_b_0_1.Copy_of_Integracion_b.main(Copy_of_Integracion_b.java:10587)
disconnected
Thanks,
Gracia.