Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
it is working fine. Attached the QVW file for your reference.Check this..... Can you attached your excel sheet as well?
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);
Thanks Brind...But that is not effecting afetr adjusting the space.Something we have to look into at 'smartseniorgroup'.
Thanks,
Ajay
it is working fine. Attached the QVW file for your reference.Check this..... Can you attached your excel sheet as well?
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
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.