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?
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
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 😉