[resolved] Capturing record counts into a variables

Highlighted
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
Highlighted
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

View solution in original post


All Replies
Highlighted
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
Highlighted
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;
Highlighted
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
Highlighted
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.
Highlighted
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

View solution in original post

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog