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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

RE:IF again

Hi all,

I have samll error in below  code.

if(vServerName='1-2-3-4','1-2-3-4',if(vServerName='1-0-3-4','1-0-3-4',if (vServerName = 'ABC','CBD' ))) as vServerName

end if;

can anyone give suggestions on this

Thanks in advance.est

Chanty

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

May be you just need to define a variable like:

Let vServerName=ComputerName();

And then use this variable like:

IF vServerName='ABC' Then

Do this...

   Else IF vServerName = 'XYZ' Then

          Do.. this2

          Else IF vServerName= 'Others' Then

                   Do ..that

          End IF    

   End IF

End IF

View solution in original post

4 Replies
sunny_talwar
MVP
MVP

Is this within the LOAD statement? If it is, I don't think you need a ENDIF

If(vServerName = '1-2-3-4','1-2-3-4',

if(vServerName = '1-0-3-4','1-0-3-4',

If(vServerName = 'ABC', 'CBD'))) as vServerName

tresB
Champion III
Champion III

May be you just need to define a variable like:

Let vServerName=ComputerName();

And then use this variable like:

IF vServerName='ABC' Then

Do this...

   Else IF vServerName = 'XYZ' Then

          Do.. this2

          Else IF vServerName= 'Others' Then

                   Do ..that

          End IF    

   End IF

End IF

Chanty4u
MVP
MVP
Author

Thanks sunny &Tre

jagan
Partner - Champion III
Partner - Champion III

Hi,

You can simply use this

if(vServerName= 'ABC','CBD', If(Mixmatch(vServerName, '1-2-3-4', '1-0-3-4'), vServerName)) as vServerName

Regards,

Jagan.