Unable to get row counts

One Star

Unable to get row counts

Hello All,
I've set up a job that does the following:
1) Query salesforce with a salesforce input component for all case records that match a certain criteria
2) Use an iterateToFlow to call another salesforce input component to get all the emailMessages related to each case
3) Insert those emails into a mysql database via a mysql output component
4) Delete the successful inserts from salesforce via a salesforce output component.
This job works correctly at the moment. What I need to add is a piece to update the case record with the number of emails put in the mysql database. My problem is that I cannot seem to get the row count of inserts for the mysql database. Unfortunately, nothing I have tried has allowed me to get the successful insert count of emails per case. Does anyone know how to get the row counts for the mysql insert per iterate successfully?
Community Manager

Re: Unable to get row counts

Hi
There is a global variable like ((Integer)globalMap.get("tMysqlOutput_1_NB_LINE_INSERTED")) that counts the number of inserted records into target DB, press ctrl+bank space in any text field of a component, you will see a list of the global vriables are avaiable and select the one you want to use.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Unable to get row counts

I've attempted to use that value, but no matter what I do I am unable to get anything but null from it.
Seventeen Stars

Re: Unable to get row counts

Yes. Talend does not create code for this output variable if the output db component works in batch mode (or extended insert mode). Use the simple NB_LINE value instead: ((Integer)globalMap.get("tMysqlOutput_1_NB_LINE")).
BTW. it would be easy to provide an insert counter also in the batch mode because the executeBatch() method from the JDBC API returns an array with counts of changed dataset for EVERY single statement in the batch.
There is space for improvements a lot ;-)
One Star

Re: Unable to get row counts

Thanks for the replies. I've ended up using my own counter with global var and a Numeric.sequence call to get the row counts the way I need them.
Community Manager

Re: Unable to get row counts

Feel free to Create a request for enhancement in JIRA.
Cheers,
Elisa