One Star

Job control: Control the number of lines with talend

Hello,
I have a source table and a target table must have the same number of lines. So I want to create a job control that compares two tables and it gets error if there is a difference. Please how can I do with Talend Open Studio?
Thank you in advance.
6 REPLIES
Moderator

Re: Job control: Control the number of lines with talend

Hi,
I think you are looking for "Sync".
For community version, you can use "incremental load" by contrasting source table and target table.
The workflow should be :
targettable-->mainrow-->tMap-->rejectrow-->output
sourcetable-->lookuprow
Join the two tables and make inner join on tMap. Set "catch lookup inner join reject " as true and the changed date is the unassociated data by inner join.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Job control: Control the number of lines with talend

hello,
Can you explain please a little more because I want to do a job that will control after loading job.
Thank you very much.
One Star

Re: Job control: Control the number of lines with talend

you can send me an exmple please?
Seventeen Stars

Re: Job control: Control the number of lines with talend

All input and output components provides counters of type Integer like tOracleInput_NB_LINE. All these counters can retrieved by drag & drop from the Outline view.
You can use the NB_LINE counters to compare the amount of input with the output.
Example for tWarn message:
((Integer) globalMap.get("tOracleInput_NB_LINE")).equals(((Integer) globalMap.get("tOracleOutput_NB_LINE"))) ? "is equal" : "is NOT equal"
One Star

Re: Job control: Control the number of lines with talend

Thank you very much for your help. I'm starting with Talend. How can I put the message you gave me in the tWarn? I have MySQL tables, so how I can use tMySqlInput_NB_LINE. Is that you can send me the pattern of Job please because I'm stuck?
Thank you in advance.
One Star

Re: Job control: Control the number of lines with talend

Note: I use Talend Open Studio 5.3.1, I can not find NB_LINE counters.