[resolved] Capturing record counts into a variables

One Star

[resolved] Capturing record counts into a variables

Is there any component or technique to capture record counts of rows going though the data pipeline at various points, into context variables?
for Example:
Count of rows coming out of tOracleInput
Count of rows coming into tOracleOutput => rows inserted, and rows updated
thanks,
Dave

Accepted Solutions
Four Stars

Re: [resolved] Capturing record counts into a variables

Hi Santhosh,
Remove tJava, component, and link from flowmeter component to flowcatcher and then test again...
Vaibhav

All Replies
Community Manager

Re: [resolved] Capturing record counts into a variables

Hello
There are some global vars which counts the number of rows out ot input component and insert into target components.
like
((Integer)globalMap.get("tOracleInput_1_NB_LINE"))
tip: press ctrl+blank space on tJava or any text field, you will a list of global vars.
eg:
tOracleInput--main-->tOracleOutput
|
onsubjobok
|
tJava
on tJava, type in:
context.query=((Integer)globalMap.get("tOracleInput_1_NB_LINE"));
context.update=((Integer)globalMap.get("tOracleOutput_1_NB_LINE_UPDATED"));
context.insert=((Integer)globalMap.get("tOracleOutput_1_NB_LINE_INSERTED"));
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Capturing record counts into a variables

Hello
There are some global vars which counts the number of rows out ot input component and insert into target components.
like
((Integer)globalMap.get("tOracleInput_1_NB_LINE"))
tip: press ctrl+blank space on tJava or any text field, you will a list of global vars.
eg:
tOracleInput--main-->tOracleOutput
|
onsubjobok
|
tJava
on tJava, type in:
context.query=((Integer)globalMap.get("tOracleInput_1_NB_LINE"));
context.update=((Integer)globalMap.get("tOracleOutput_1_NB_LINE_UPDATED"));
context.insert=((Integer)globalMap.get("tOracleOutput_1_NB_LINE_INSERTED"));
Best regards

shong

Is there a "OracleInput_1_NB_REJECT" global? I do not see that generated in the talend code.
I want to connect a runIf trigger from tOracleOutput_1 to a downstream tOracleRollback, based on ((Integer)globalMap.get("tOracleOutput_1_NB_LINE_REJECT")) > 0
thanks,
Dave
Employee

Re: [resolved] Capturing record counts into a variables

David,
You can create a "REJECT" link relationship after your tOracleOutput and link that to a tFileOutputDelimited to grab the exception in a File.
This component have a globalVar returning the NB_LINE; it's exactly what you're looking for.
Best regards;
One Star

Re: [resolved] Capturing record counts into a variables

Hi Shong,
I am new to Talend. I am trying to get the count of a table to insert into another. I am not getting any errors. But it inserts NULL value in "trgtcnt" column of my table,
mysql - Flowmerter - tmap1 - TMysqlOutput3
\ |
\ tJava
\ |
Flowcatcer - tmap2 - mysql
Here is my tJava query
context.query=((Integer)globalMap.get("tMysqlOutput_3_NB_LINE"));
Please advice me to move forward.
Thanks in Advance
Santhosh
One Star

Re: [resolved] Capturing record counts into a variables

Hi Shong,
I am new to Talend. I am trying to get the count of a table to insert into another. I am not getting any errors. But it inserts NULL value in "trgtcnt" column of my table,
mysql - Flowmerter - tmap1 - TMysqlOutput3
\ |
\ tJava
\ |
Flowcatcer - tmap2 - mysql
Here is my tJava query
context.query=((Integer)globalMap.get("tMysqlOutput_3_NB_LINE"));
Please advice me to move forward.
Four Stars

Re: [resolved] Capturing record counts into a variables

Hi Santhosh,
Remove tJava, component, and link from flowmeter component to flowcatcher and then test again...
Vaibhav