Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've the following in tDBInput (Amazon Redshift) -
"select ln_id, ln_typ from ln_table where 1=1" +
(
(context.load_type).equalsIgnoreCase("HISTORY") ? "" : (" and aqsn_dt <= rec_cren_dttm")
)
If I do not have the beginning and ending braces after the + sign as shown above, then I get an error in Talend saying - Type mismatch: cannot convert from String to boolean. What is the need of putting the braces around the whole conditional expression?
Hi
The query filed does not support ternary expression, you can define the query on a tJava before tDBInput, eg:
tJava
|onsubjobok
tDBInput--main...>
on tJava:
if((context.load_type).equalsIgnoreCase("HISTORY")){
context.query="select ln_id, ln_typ from ln_table where 1=1";
}else{
context.query="select ln_id, ln_typ from ln_table where 1=1 and aqsn_dt <= rec_cren_dttm";
}
In the Query field of tDBInput, set the query as: context.query
Regards
Shong