Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

leocattqv
Contributor

load and IF Statement

Hi there,

I am having some difficulty with the syntax of the if statement in my load.  I am attempting to say

IF [Field] = Yes OR No, then True, False

the syntax I have is

if (([Field1])='Yes' or ([Field1])='No', 'Reviewed') as REVIEW

im sure this is a simple one but Im stuck, any suggestions?

5 Replies
MVP
MVP

Re: load and IF Statement

What is exactely your issue?

T:

LOAD *,

  if (([Field1])='Yes' or ([Field1])='No', 'Reviewed') as REVIEW

INLINE [

Field1

Yes

No

Maybe

];

seems to work for me.

leocattqv
Contributor

Re: load and IF Statement

Hi,

Qlik doesnt seem to like the comma between 'No', and 'Reviewed'

I get an error in the script

(([Field1])='Yes' or ([Field1])='No', 'Reviewed') as REVIEW,

MVP
MVP

Re: load and IF Statement

Please post your complete Load statement.

Re: load and IF Statement

Hi,

If(Field1='Yes' or Field1='No', 'Reviewed') as REVIEW

or

If(Match(Field1,'Yes','No'), 'Reviewed') as REVIEW

should also work.

No reason for a comma causing an error.

Maybe it would help if you posted the error message and some sample data?

thanks

regards

Marco

raman_rastogi
Contributor II

Re: load and IF Statement

try this

if(Field1='yes','true',if(Field1='no','false'))

Community Browser