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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

syntax for IF ...... THEN statement

Hi,

I need to create a field with the following condition:

if ( A = '1' and B = '1' and C = '2', THEN customer = ' shop1', customer) AS newCustomer

My issue is that I need certain conditions to be met and I need to say when they are met that customer = 'Shop1' as a new field.

Im not sure how to write the THEN condition....

Any ideas?

Regards,

Gregg

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Inside load no need to use then statement.

Script should be like this.    

TableName:

LOAD

if ( A = '1' and B = '1' and C = '2',  ' shop1', customer) AS newCustomer

*;

Celambarasan

View solution in original post

6 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You mean like this

     Load

     *,

     if (A = '1' and B = '1' and C = '2', ' shop1', customer) AS newCustomer

..From..

Celambarasan

v_iyyappan
Specialist
Specialist

Hi,

     I attached sample QV . Hope its helpful for u.....

Regards,

Iyyappan

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this

TableName:

LOAD

     Field1,

     Field2,

     '

     '

     '

     if ( Field1 = 1 AND Field2 = 2, 'Shop1', 'Default Value') AS newCustomer

FROM DataSource;

Regards,

Jagan.

Not applicable
Author

Hi,

Its a preceding load so the full syntax is:

TableName:

LOAD

if ( A = '1' and B = '1' and C = '2', THEN customer = ' shop1', customer) AS newCustomer

*;

The above statement is not working and I think it is to do with the THEN part of it..

Regards,

Gregg

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Inside load no need to use then statement.

Script should be like this.    

TableName:

LOAD

if ( A = '1' and B = '1' and C = '2',  ' shop1', customer) AS newCustomer

*;

Celambarasan

Not applicable
Author

Hi,

Thanks, I seen my issue now - my mistake.

I was explicitly renaming the customer field using THEN but there was no need.

Regards,

Gregg