Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Newbie if question

Hi,

As part of a script I have the following lines:

    "Location Code",

    IF ("Location Code" = 'RED' or "Location Code" ='BLUE', 'COLORED', "Location Code" ) As Location,

The above statements are OK and work fine.

But what if I had a number of colors, do I all need to write them out with the 'or' statement or is there a more simple way to achieve this?

Gerrit

1 Solution

Accepted Solutions
deepakk
Partner - Specialist III
Partner - Specialist III

HI Gerrit,

you can also use mixmatch. below is the code

if(MixMatch([Location Code],'RED','BLUE')>0,COLORED,[LOCATION CODE]) as Location,

Deepak

View solution in original post

2 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

HI Gerrit,

you can also use mixmatch. below is the code

if(MixMatch([Location Code],'RED','BLUE')>0,COLORED,[LOCATION CODE]) as Location,

Deepak

Not applicable
Author

Deepak,

Thanks for your helpful reply. After your reply and with the help of the reference manual I figured out that in my script 'wildmatch' probably is the shortest way.

See 1. original script, 2. script as you suggested and 3. final solution.

1. IF ("Location Code" = 'COR-RETOUR' or "Location Code" ='COR AANTAL', 'HEDEL', "Location Code" ) As Vestiging,

2. if(MixMatch([Location Code],'COR-RETOUR','COR AANTAL')>0,'HEDEL',[Location Code]) as Vestiging, 

3. if(wildmatch([Location Code],'COR*')>0,'HEDEL',[Location Code]) as Vestiging, 

Again thanks for your help.

Regards,

Gerrit