I have a case statement which I need to convert it to Qlik Script.
ServiceChartField = '0000'
when Model like '%Accessories%' then 'Accessories'
when Model like '%Licenses%' then 'Licenses'
when SubModel like '%Software%' then 'Software'
Can you guys help me in writing the script.
So far I have got this, not sure if its correct:
if(wildmatch([Model], '*Accessories*' ),'Accessories',
if(wildmatch([Model], '*Licenses*' ), 'Licenses',
if(wildmatch([SubModel], '*Software*') ,'Software' ,
if(wildmatch([SubModel], '*System*') ,'System' ,
if(wildmatch([SubModel], '*Service*') ,'Service' ,)
I think this an accurate conversion of the CASE statement:
If(ServiceChartField = '0000',
If(Model like '*Accessories*', 'Accessories',
If(Model like '*Licenses*', 'Licenses',
If(SubModel like '*Software*', 'Software',
I prefer Like to WildMatch for a single comparison as it makes for more readable code