Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor III

issue with if condition


I had a if condition in script like

if([field 1] = 'a',  x, [field 2]) as [field 3]

so [field 3] should have value x and [field 2] values as per my knowledge.

But this is not happening in my case.

Can some help on this.



2 Replies

Re: issue with if condition

You're correct but with no extra information than this it is hard to know where the problem might be. But the condition has to be within a load statement and all the fields has to exist already in the source table that you load from. Furthermore the and the [field 2] fields has to have these names in the source table - they can't be new field names being created in the same load step.

Could you please provide us for instance with some test data that proves your point or a test app if possible?

New Contributor

Re: issue with if condition

Hi Sai,

I totally agree with Petter

As x is value try giving it in quotes :

Something like:

if([field 1] = 'a',  'x', [field 2]) as [field 3]

Community Browser