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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF Condition

Hi All

How to write this is Qlikview Script:

if "&prod_name." NE "ELECTRONICS" then do;
if compress(UPCASE(LOB)) in ("DIRECT","PORTAL","OFFLINE") then BUSINESS = "DIRECT";
else if compress(UPCASE(LOB)) in ("VENDOR","ONLINE","THIRDPARTY","DEALER","INDIRECT") then BUSINESS = "INDIRECT";
else BUSINESS = "UNALLOCATED";
END;

Any help would be appreciated.

Thanks in Advance

Eric

Labels (1)
1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

Hi Eric,

Not sure about the Compress function. May be look the below script code..

LOAD OtherFields,
if( not Match(Upper(prod_name),'ELECTRONICS'),
if( Match(Upper(LOB),'DIRECT','PORTAL','OFFLINE'),'DIRECT',
if(Match(Upper(LOB),'VENDOR','VENDOR','THIRDPARTY','DEALER','INDIRECT'),'INDIRECT',
'UNALLOCATED')))
as Field           
From Source;

View solution in original post

3 Replies
settu_periasamy
Master III
Master III

Hi Eric,

Not sure about the Compress function. May be look the below script code..

LOAD OtherFields,
if( not Match(Upper(prod_name),'ELECTRONICS'),
if( Match(Upper(LOB),'DIRECT','PORTAL','OFFLINE'),'DIRECT',
if(Match(Upper(LOB),'VENDOR','VENDOR','THIRDPARTY','DEALER','INDIRECT'),'INDIRECT',
'UNALLOCATED')))
as Field           
From Source;

sujeetsingh
Master III
Master III

if (prod_name=" NE "ELECTRONICS",
    if compress(wildmatch(UPCASE(LOB))  'DIRECT','PORTAL','OFFLINE')) ,'DIRECT',
      if compress(wildmatch(UPCASE(LOB)'VENDOR','ONLINE','THIRDPARTY','DEALER','INDIRECT') )'INDIRECT'
,'UNALLOCATED'))) as Bussines
ziadm
Specialist
Specialist

Try

Load

If (match (Upper(LOB) ,'DIRECT','PORTAL','OFFLINE') > 0,'DIRECT',If (match (Upper(LOB) ,'ONLINE','THIRDPARTY','DEALER','INDIRECT') >0, 'INDIRECT','UNALLOCATED') ) as FieldName