Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello my friends. I have had no luck so far in finding a specific working example of a SWITCH CASE statement as used in QlikView. I have added my original sample code below. Will someone please kindly re-write and then explain how this code would look and work as a SWITCH CASE statement. Thank you.
CASE
WHEN PSWHSE = 001 THEN TRIM(PSAREA) || TRIM(PSZONE) || LEFT(TRIM(PSAISL,1)) || TRIM(PSBAY)
WHEN PSWHSE = 003 THEN TRIM(PSAISL) || TRIM(PSLEVL) || TRIM(PSPOSN)
WHEN PSWHSE = 031 THEN TRIM(PSAISL) || TRIM(PSLEVL) || TRIM(PSPOSN)
END
AS RESERVELOCATION
Maybe like this?
pick(match(PSWHSE,001,003,031)
, TRIM(PSAREA) & TRIM(PSZONE) & LEFT(TRIM(PSAISL,1)) & TRIM(PSBAY)
, TRIM(PSAISL) & TRIM(PSLEVL) & TRIM(PSPOSN)
, TRIM(PSAISL) & TRIM(PSLEVL) & TRIM(PSPOSN)
) AS RESERVELOCATION
within a LOAD.
see link
hope this helps you
http://community.qlik.com/ideas/2563
http://www.qlikblog.at/546/qliktip-20-selectcase-qlikview-loadsc...
Maybe like this?
pick(match(PSWHSE,001,003,031)
, TRIM(PSAREA) & TRIM(PSZONE) & LEFT(TRIM(PSAISL,1)) & TRIM(PSBAY)
, TRIM(PSAISL) & TRIM(PSLEVL) & TRIM(PSPOSN)
, TRIM(PSAISL) & TRIM(PSLEVL) & TRIM(PSPOSN)
) AS RESERVELOCATION
within a LOAD.
This is exactly what I was looking for. Thank you so much!!!!!! ☺
Is it possible to add Else condition in this expression.
Thanks,
Neha
Try this
pick(match(PSWHSE,001,003,031)+1
, else_expression
, TRIM(PSAREA) & TRIM(PSZONE) & LEFT(TRIM(PSAISL,1)) & TRIM(PSBAY)
, TRIM(PSAISL) & TRIM(PSLEVL) & TRIM(PSPOSN)
, TRIM(PSAISL) & TRIM(PSLEVL) & TRIM(PSPOSN)
)