Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I am a beginner in Talend, I currently work on Talend Open Studio for Data Integration.
I need to get all informations from my job / subjob and insert them into a table:
JOB_NAME character # Job Name
LOAD_TYPE character # Loading status (Insert / Update)
STATUS character # Job status / under job (OK / KO)
JOB_STIME date # Start date of job / subjob
JOB_ETIME date # End date of job / subjob
I managed to get the JOB_NAME thanks to a tMap connected to the tLogCatcher (field : job) but I do not know how to get the other fields despite my research.
In thanking you and apologizing for this trivial question for Talend experts.
Regards
Ok well, is it this mapping which i must do ? (Joined in my message)
1 : Input database
2 : Output database
tPostgresqlOutput_5 : Output log database
And I put in the tJava :
((Integer)globalMap.get("2_NB_LINE_INSERTED"));
i'm not sure of the name of my component, where can I see it ? Because "2" is an alias I think and when i put 2 in the formula, it doesn't work.
Thank you
To get the name of the component, click on it and you will see it in brackets in the Component tab.
Yes but in my case the name of my table in brackets, doesn't work with the formula :
((Integer)globalMap.get("fact_table_NB_LINE_INSERTED"))
Click on your output component and take a screen shot of your component tab. Then post it.
You need to use....
((Integer)globalMap.get("tPostgresqlOutput_1_NB_LINE_INSERTED"))
YEAAAAAAAH, it's work
Last question :
I would like to run my job in function of the last return status.
For exemple, in my AMC table, my last job finished with "success" status, so I can run another time my job.
But when my last status is "failed", I would like to "block" the launching and inform the users.
Best regards
This is easy. Just query your database for the last status. The use the value to decide what to do.
Connect your database component to a tFlowToIterate. The tFlowToIterate will produce a globalMap variable holding your status data returned from your query. It will be in the format....
((String)globalMap.get("row.column"))
Please note "row.column" refers to the name of the row feeding the tFlowToIterate and the name of the column holding the status value. This will need to be changed accordingly.
From the tFlowToIterate use RunIf connectors to join to a component to inform your users that it cannot be run (maybe a tJava with a System.out command) and to the start component of this job. In the success link use logic like this....
((String)globalMap.get("row.column")).compareToIgnoreCase("success")==0
....in the failed link use logic like this.....
((String)globalMap.get("row.column")).compareToIgnoreCase("failed")==0
Then, when you run the job it will check the result of your last run and if it was a success, it will run the main body of the job. If it was a failure it will run the mechanism to to inform of an issue
Ok perfect, I will check that later.
Concerning my previous question, how can I get the PID in a tFixedFlowInput ?
Is there a standard variable to get it ?
Thank you
You can get the PID from any Talend job using the variable pid. In a tJava component you can print it out to the output using the following code....
System.out.println("My PID is "+pid);