Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Talend execution pre conditon set

Hello Everyone,

i have a talend job which use tHiveRow to run query , how can i add some validation before run query.

So for example ,

Query Test1= insert into table a select * from table B.

Validation Test2=select max(date) from B.

if the result of Test2='2019-09-05' , then exit running but not throw excepting or error log, if Test2='2019-10-05' , then run query.

 

i am very novice in talend , please help and thanks so much in advance.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
Use a tHiveInput to query the max date and use runIf trigger to control the tHiveRow execution, eg:
tHiveInput--main--tJavaRow--runIf--tHiveRow

on tJavaRow:
if(TalendDate.compareDate(input_row.dateColumnName, TalendDate.parseDate("yyyy-MM-dd", "2019-10-05"))==0){
context.isContinue=true;
}else{
context.isContinue=false;
}

//Define a context variable isContinue with boolean type.

Set the condition of runIf as:
context.isContinue

Regards
Shong

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi
Use a tHiveInput to query the max date and use runIf trigger to control the tHiveRow execution, eg:
tHiveInput--main--tJavaRow--runIf--tHiveRow

on tJavaRow:
if(TalendDate.compareDate(input_row.dateColumnName, TalendDate.parseDate("yyyy-MM-dd", "2019-10-05"))==0){
context.isContinue=true;
}else{
context.isContinue=false;
}

//Define a context variable isContinue with boolean type.

Set the condition of runIf as:
context.isContinue

Regards
Shong

Anonymous
Not applicable
Author

Thanks so much Shong. Just a note for other new learner , when we are using the TalendDate.compareDate(input_row.dateColumnName, TalendDate.parseDate("yyyy-MM-dd", "2019-10-05") , have to make sure both columns are date type.