Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rupaliqlik
Partner - Creator
Partner - Creator

How to use subfield function with if else

Hi Team,

I want to convert the string. Kindly help me here.

I am writing below condition in scrip level  which gave me correct ouput where ':' sign is present but other highlighted korean string is ignored so which give blank product cat in front of materail id.

Please help me how to write here.

subfield(Product_Cat,':',2) as Product_Cat_Jap,

rupaliqlik_0-1634797886548.png

Thanks,

Rupali

@sunny_talwar @jagan  @abhijitnalekar @ kaushik.solanki ,@

4 Replies
abhijitnalekar
Specialist II
Specialist II

Hi @rupaliqlik ,

 

Add one more condition like

if (match(Product_Cat,':')>0, subfield(Product_Cat,':',2) , Product_Cat) 

Hope this solves the purpose

Regards,
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!
rupaliqlik
Partner - Creator
Partner - Creator
Author

HI @abhijitnalekar 

I tried below logic and it works. Is this correct ?

If(FindOneOf( Product_Cat, ':'),subfield(Product_Cat,':',2),[商品サブカテゴリ]) as Product_Cat_Jap,

Thanks ,

Rupali

 

 

abhijitnalekar
Specialist II
Specialist II

If(FindOneOf( Product_Cat, ':')>0,subfield(Product_Cat,':',2),[商品サブカテゴリ]) as Product_Cat_Jap,

Regards,
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!
Vegar
MVP
MVP

Looking at your sample it seems like you are trying to get the last subfield value separately by ':' for Product_Cat.

Maybe you can simplfy your expression to this:

subfield(Product_Cat,':',-1) as Product_Cat_Japan