Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Join “Do More With Qlik” with Mike Tarallo to get a first-hand look at the New Authoring Experience, June 29th: REGISTER HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
gsaipranathi
Contributor III
Contributor III

issue with if condition

Hi,

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.

Regards,

Pranathi.

2 Replies
petter
Partner
Partner

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?

karthik123citys
Partner
Partner

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]