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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
AAA999
Contributor III
Contributor III

How to implement multiple case statement in Tmap

Talend Gurus,

can anyone let me know how to handle multiple case statement in Tmap?

 

nvl(CASE WHEN regexp_instr(F1,'/|,| ') = 0 THEN
REPLACE(F1,' ')
ELSE substr(F1,1,regexp_instr(F1,'/|,| ')-1)
END
,F1)
as X1,


CASE WHEN regexp_instr(F1,'/|,| ') = 0 THEN NULL ELSE
REGEXP_REPLACE(SUBSTR(F1, regexp_instr(F1,'/|,| ')),'/|,|')
END AS X2,

 

(CASE WHEN INSTR (F1,'@',1,2) = 0
OR F1 LIKE '%<%' OR F1 LIKE '%>%' OR UPPER(F1) LIKE '%IN%' OR LENGTH(F1) >= 10
THEN 'Y' ELSE 'N' END) AS Y,

 

(CASE WHEN INSTR (F1,'@',1,2) = 0 THEN 'A'
WHEN F1 LIKE '%<%' OR F1 LIKE '%>%' THEN 'C'
WHEN UPPER(F1) LIKE '%IN%' THEN 'CI'
WHEN LENGTH(F1) >= 10 THEN 'L'
END) AS Z

 

Thanks

 

Labels (1)
  • v7.x

12 Replies
akumar2301
Specialist II
Specialist II

did this help?
AAA999
Contributor III
Contributor III
Author

not resolved
ankit7359
Creator II
Creator II

Hi @AAA999 ,

As per your scenario, i have a query though will the delimiter option be the same, will it always consist of ", or / or ; etc"???

One solution what you can implement as per your sample data is - 

you can create a variable in tmap and give the logic as if the row consists any of the specified delimiter then it will give the specified result.(if you dont want to use user-defined routines)

else you can go with @uganesh 's solution of textractregexfield or you can try textractdelimitedfields.

Logic - 

row1.column1.consists(";")?TalendStringHandling.Left(row1.column1,TalendStringHandling.indexof(";"))

:row1.column1.consists("/")?TalendStringHandling.Left(row1.column1,TalendStringHandling.indexof("/"))

:etc.

You can use substring function as well, if you dont want to use in-build Stringhandling functions.

Pls do share your job designs and results if you have any issues.

Pls get back to Community, if necessary.

Thanks,

Ankit.