Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Talend Folks,
i need your help. could you please tell me. how to convert the below SQL case statement into if\else using tmap components for talend.
(case
when
(case
when t1.Sales = 'others' and t2.Bundled = 'Bundled'
then 'Bundled'
else t1.Sales end) = 'others'
then 'Discounted'
else
(case
when t1.Sales = 'others' and t2.Bundled = 'Bundled'
then 'Bundled'
else t1.Sales end)
end) AS Bundle
Can you share the flow schema?
Is only 1 flow or 2?
Also give a sample input data with expected result.
My source is excel file. I have sql logic. i need to create same sql expression in talend using tmap.
Sales Excel and drop it to the design work space and select tfileInputExcel option from pop window then am using tmap component. I dragged all columns into output excel file side then I Just created new column as bundled then I wrote if \ else Statement. the logic is given below
((row8.Sales == "others" && row9.Bundled== "Bundled") ? "Bundled" : ((row8.Sales) == "others" ? "Discounted" :
((row8.Sales == "others" && row9.Bundled== "Bundled") ? "Bundled" :
((row8.Sales)))))
Above logic is not working. am getting error
1st, don't use "==" to compare strings, use String.equals method or String.equalsIgnoreCase instead giving:
"others".equals(row8.Sales)
and so on.
2nd, rethink the logic, you have twice the same test (row8.Sales == "others" && row9.Bundled == "Bundled") which cannot occurs.
Hello,
You can use condition statement in tMap :
row1.myKey.equals("FirstValue")?1:0
which allow you to do your query in the variable window and get the result in the tMap output.
Thanks,
Med
Hi All,
i need to convert the below case statement in talend
CASE WHEN mcw_qualitypot_prod_event_deduped.qualitypot_prod_task_type ="IMAGE_REVIEW"
AND mcw_qualitypot_prod_event_deduped.qualitypot_prod_error :: text ='incorrectRejected'
THEN count(
mcw_qualitypot_prod_event_deduped.qualitypot_prod_error
) ELSE NULL END AS quality_incorrectrejectedpots,
please provide solution for the above requirement
@Shekar_genupula if the answer in this post is not sufficient for your case, open a new post.