Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

If then elseif

Hi there

I currently have the following within my script to load a qvd file :

if(CT_YEAR = 'C', 2010, if(CT_YEAR = 'L', 2009)) as [ACYear],

I'd like to cater for another option 'N' :

if CT_YEAR = 'C' then
ACYear = '2010'
elseif CT_YEAR = 'L' then
ACYear='2009'
elseif CT_YEAR = 'N' then
ACYear ='2011'
endif

Can anyone advise how to set this up within the load script?

Thanks

Bob

1 Solution

Accepted Solutions
Not applicable

If then elseif

if(CT_YEAR = 'C','2010',if(CT_YEAR = 'L','2009',if(CT_YEAR = 'N','2011'))) as ACYear,

please try the above script .

4 Replies
Not applicable

If then elseif

if(CT_YEAR = 'C','2010',if(CT_YEAR = 'L','2009',if(CT_YEAR = 'N','2011'))) as ACYear,

please try the above script .

Highlighted
Not applicable

If then elseif

Try



If

9999 is the catchall error

(CT_YEAR = 'C', '2010', If (CT_YEAR = 'L','2009', If (CT_YEAR = 'N','2011', '9999'))) As ACYear,



matt_crowther
Valued Contributor

If then elseif

I may be missing somehting but the way I'd do the above is:

=if(CT_YEAR = 'C','2010',if(CT_YEAR = 'L','2009',if(CT_YEAR = 'N','2011','Outside Range'))) as ACYear,

Just like a running IF expression in Excel.

Alternatively look into using a Mapping load and 'Apply Map' in the script.

Hope that helps,

Matt - Visual Analytics Ltd

Not applicable

If then elseif

Hi

I tried the solution given by priyadashin and it worked fine. Thanks to everyone who replied.

Bob