Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ajaykumar1
Creator III
Creator III

Wildmatch for 2 and 3 conditions with new value deriving

Hi All,

I have a small requirement like below.

Country

Type

code

Category

India_123

Smart salary

BZAAGK0K

TDS SENIOR

US-123

SS Salary

291BSL

SENIOR

Mexico

Smart Der

ALLALL

SENIOR

London

Smart New

BZAAGK0K

PROMOTE

Europe

Smart New

BZAAGK0K

SENIOR

Condition 1: If my field ‘TYPE’ contains any value match with ‘smart’ and the CODE is BZAAGK0K then I have to show the one more value in TYPE as ‘Smart group’(i.e. 2 conditions match case)

Condition 2 :If my field ‘TYPE’ contains any value match ‘smart’ and the CODE is BZAAGK0K and ‘CATEGORY’ is match with ‘SENIOR’ then I have to show the one more value in TYPE as ‘Smart senior group’((i.e. 3 conditions match case)

It will be also helpful if we create the one more field like ‘TYPE2’ with the filling of all conditions.

Note : I have to calculate the conditions based on TYPE field .

I have written the script:

LOAD Country,

     Type as Type2,

     if(WildMatch(Type,'*smart*') and wildmatch (code,'BZAAGK0K '),'Smart group',

      if(wildmatch(Type,'*smart*') and WildMatch(code,'BZAAGK0K') and WILDMATCH(Category,'*SENIOR*'),'smartseniorgroup',Type))        as Type,

     code,

     Category

FROM

C:\Users\windows\Desktop\wildmatch.xlsx

(ooxml, embedded labels, table is Sheet1);

With the above script am not getting the second condition case level i have stucked.

1 Solution

Accepted Solutions
brindlogcool
Creator III
Creator III

it is working fine. Attached the QVW file for your reference.Check this..... Can you attached your excel sheet as well?

View solution in original post

5 Replies
brindlogcool
Creator III
Creator III

Your code is working fine. Just check the space in the wildmatch

LOAD Country,

     Type as Type2,

     if(WildMatch(Type,'*smart*') and wildmatch (code,'BZAAGK0K '),'Smart group',

      if(wildmatch(Type,'*smart*') and WildMatch(code,'BZAAGK0K') and       WILDMATCH(Category,'*SENIOR*'),'smartseniorgroup',Type)) as Type,

     code,

     Category

FROM

C:\Users\windows\Desktop\wildmatch.xlsx

(ooxml, embedded labels, table is Sheet1);

ajaykumar1
Creator III
Creator III
Author

Thanks Brind...But that is not effecting afetr adjusting the space.Something we have to look into at 'smartseniorgroup'.

Thanks,

Ajay

brindlogcool
Creator III
Creator III

it is working fine. Attached the QVW file for your reference.Check this..... Can you attached your excel sheet as well?

ajaykumar1
Creator III
Creator III
Author

Thanks Brind....Its seems working.But you did in a logical way like up-down the script.

Its very helpful to me what exactly the difference between the both.

PFA of input data

brindlogcool
Creator III
Creator III

As per your script the first if condition always getting satisfied (Type= smart and code= BZAAGK0K )and hence it is not checking the second if condition.