Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
In my application so many CASE statements have been used to extract the data from database at script level. But today I got requirement that need to replace CASE statements with qlikview functions. But I am not able to find that. Could you please some one help me?
EX:
CASE WHEN A.N_ACRONYM = B.N_ACRONYM THEN 0 ELSE A.EAD END as EAD_WA
CASE WHEN CLOSEOUT_AGREEMENT_NUMBER = '0' THEN A.EAD ELSE A.NET_EAD END AS EAD,
A.EAD_M_UNCAPPED ,
CASE WHEN CLOSEOUT_AGREEMENT_NUMBER = '0' THEN A.EAD_UK ELSE A.NET_EAD_UK END AS
CASE WHEN A.N_ACRONYM = B.N_ACRONYM THEN 0 ELSE A.PD_FLOOR END as PD_FLOOR_WA,
CASE WHEN A.N_ACRONYM = B.N_ACRONYM THEN 0 ELSE A.EAD END as EAD_WA,
CASE WHEN A.N_ACRONYM = B.N_ACRONYM THEN 0 ELSE A.LGD END as LGD_WA
CASE WHEN CLOSEOUT_AGREEMENT_NUMBER = '0' THEN A.EAD ELSE A.NET_EAD END AS EAD,
A.EAD_M_UNCAPPED ,
CASE WHEN CLOSEOUT_AGREEMENT_NUMBER = '0' THEN A.EAD_UK ELSE A.NET_EAD_UK END AS EAD_UK ,
Thank you
Hi,
My data is from SYBASE- Database. So is IF statement will support at script
Thank you.
You can use If in the script as below
Load
If(N_ACRONYM_A = N_ACRONYM_B, 0, EAD ) As EAD_WA,
If(CLOSEOUT_AGREEMENT_NUMBER = '0',EAD,NET_EAD) As EAD;
Sql Select A.N_ACRONYM As N_ACRONYM_A,
B.N_ACRONYM As N_ACRONYM_B,
...
From ...
The IF statement being suggested here is being executed by the Qlikview engine because it is written in the 'preceding load' part of the script. It doesn't matter from which database the data comes.
When writing code that comes after the SQL SELECT part, this is executed by the database engine so needs to comply with the database query language AND also be supported by the driver being used to connect to the database.
Thanks Anbu,
I could understand clearly and I made it at my work.
Thank you.