Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
raadwiptec
Creator II
Creator II

like condition

Hi All

My data look as below

prodcodename

10CAPACITOR

20ASSEMBLY

35WIRES

44SWITCHES

I want to have something like this to adda new column .in the script .if  prodcodename has 10 then CA

if  prodcodename has 20 then ASM

if  prodcodename has 35 then WI

I tried few like conditions match etc..but null values are coming

3 Replies
MK_QSL
MVP
MVP

Load

  prodcodename,

  Pick(WildMatch(prodcodename,'*10*','*20*','*35*'),'CA','ASM','WI') as Flag

Inline

[

  prodcodename

  10CAPACITOR

  20ASSEMBLY

  35WIRES

  44SWITCHES

];

puttemans
Specialist
Specialist

Hi there,

Is it always the first 2 digits? If so, then you can try something like this :

Map_type

MAPPING LOAD * inline

[10, CA

20, ASM

35, WI]

Load

     Applymap('Map_type', left(yourvariable, 2), '-') as Flag

FROM ....

(a sample file would help)

Regards,

Johan

Not applicable

Hi raad, try this:

TEST:

LOAD

if ( isNull(prodcodename)=-1 , '00' , // I put '00' but you can put the value that you want or just '' or null()

     if( wildmatch(prodcodename , '*10*')=1 , 'CA' ,

          if( wildmatch(prodcodename , '*20*')=1 , 'ASM' ,

               if ( wildmatch(prodcodename , '*35*')=1 , 'WI' ,

                    if ( wildmatch(prodcodename , '*44*')=1 , 'SW' , ) ) ) ) ) as FLAG;

I hope that it help you !

Regards

Agustin