Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
raadwiptec
Creator II
Creator II

if condition

hi all,

this is my scenario.

if product name contains 'decoder'  then 'DC'

if product name contains 'connectorsr'  then 'CN'

if product name contains 'capacitorr'  then 'CP'

so it should look like below

id ¦ product  ¦ category

1     decoder  DC

2     connector  CN

3   capacitor     CP

please suggest both on script and expression

19 Replies
sunny_talwar

May be this:

for script -

Pick(WildMatch(product, '*decoder*', '*connector*', '*capacitor*'), 'DC', 'CN', 'CP') as category

for expression -

=Pick(WildMatch(product, '*decoder*', '*connector*', '*capacitor*'), 'DC', 'CN', 'CP')

lironbaram
Partner - Master III
Partner - Master III

script

if(wildmatch(product , '*decoder*'),'DC' ,

     if(wildmatch(product , '*connector*'),'CN' ,

          if(wildmatch(product , '*cpacitor*'),'CP')) As category

calculated Dimension

aggr(,

if(wildmatch(product , '*decoder*'),'DC' ,

     if(wildmatch(product , '*connector*'),'CN' ,

          if(wildmatch(product , '*cpacitor*'),'CP')),product)

raadwiptec
Creator II
Creator II
Author

hi sunny,

if this 3 does not match then the condition should be 'not mapped'. how to get that?

sunny_talwar

Try this:

for script:

Pick(WildMatch(product, '*decoder*', '*connector*', '*capacitor*', product), 'DC', 'CN', 'CP', 'Not Mapped') as category

for expression:

=Pick(WildMatch(product, '*decoder*', '*connector*', '*capacitor*', product), 'DC', 'CN', 'CP', 'Not Mapped')

HirisH_V7
Master
Master

Hi ,

Pick(WildMatch(product, '*decoder*', '*connector*', '*capacitor*','*'), 'DC', 'CN', 'CP','Not  Mapped') as category

You can use like this in script .

Thanks,

hirish

HirisH
“Aspire to Inspire before we Expire!”
raadwiptec
Creator II
Creator II
Author

thanks sunny just one more question as my data looks little messy..how can I have 2 conditions

for ex:

if product contains decoder and decoderNew then 'DC'

sunny_talwar

the asterisk next decoder will take care of decoderNew

raadwiptec
Creator II
Creator II
Author

Hi sunny,

Iam also getting strange results means. I could see all the codes  gets repeated thrice in each

sunny_talwar

Can you share your script?