Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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 - Champion III
Partner - Champion III

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 - Contributor
Partner - Contributor

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]