Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a case statement which I need to convert it to Qlik Script.
case when
ServiceChartField = '0000'
then
case
when Model like '%Accessories%' then 'Accessories'
when Model like '%Licenses%' then 'Licenses'
when SubModel like '%Software%' then 'Software'
else
'System'
end
else 'Service'
end
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',
'System'))),
'Service'
)
I prefer Like to WildMatch for a single comparison as it makes for more readable code
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',
'System'))),
'Service'
)
I prefer Like to WildMatch for a single comparison as it makes for more readable code