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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
dipanjan93
Contributor
Contributor

Implementing Case Statement in tmap

Hi All,

 

I have couple of doubts.

 

1. How can i implement the below CASE logic inside tMap?

CASE
WHEN month = "Jan" THEN 1
WHEN month = "Feb" THEN 2
WHEN month = "Mar" THEN 3
WHEN month = "Apr" THEN 4
WHEN month = "May" THEN 5
WHEN month = "Jun" THEN 6
WHEN month = "Jul" THEN 7
WHEN month = "Aug" THEN 8
WHEN month = "Sep" THEN 9
WHEN month = "Oct" THEN 10
WHEN month = "Nov" THEN 11
WHEN month = "Dec" THEN 12

 

2. If my source input is excel and the target column is in PostgreSQL then how can i insert values to this target column using the worksheet name as per the CASE logic below-

CASE
WHEN data FROM PlannedPLC Worksheet THEN "PLC"
WHEN data FROM MDR Worksheet THEN "PLC"
WHEN data FROM DOSH Worksheet THEN "PLC"
WHEN data FROM PlannedGS Worksheet THEN "Gas"

 

Thanks in advance!

 

Best Regards,

Dipanjan

Labels (2)
3 Replies
Anonymous
Not applicable

dipanjan93
Contributor
Contributor
Author

Hi @rhall,

Many Thanks for the prompt response.
This way I was able to solve my 1st issue. Anything regarding the second issue?

Regards,
Dipanjan
Anonymous
Not applicable

You can use a global variable for that. This variable...
((String)globalMap.get("tFileInputExcel_1_CURRENT_SHEET"))
..... will tell your tMap what the current sheet is. Remember that the key is the name of your component. Basically you will need to change the number.