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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load from Excel, SQL Case statement equivalent

Hello,

I normally load directly from an SQL server and have been adding fields using a Case statement in the script.  For example:

Datatable:

Select

Term

,CASE

WHEN Term is null then 'No Term'

WHEN Term <=12 then '0-12'

WHEN Term >=13 and Term <=24 then '13-24'

WHEN Term >=25 and Term <=36 then '25-36'

ELSE '37+'

End as term_band

I would like to create the same type of field when loading from an excel file.

Thanks,

Paul

1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

Your QlikView load script will be as follows:

LOAD Term,

     If (IsNull(Term),'No Term',

     If (Term <= 12,'0-12',

     If (Term <= 24,'13-24',

     If (Term <= 36,'25-36','37+')))) as term_band,

     ....

FROM TestExcelLoad.xlsx

(ooxml, embedded labels, table is Sheet1);

I tested it and it works.

View solution in original post

1 Reply
nagaiank
Specialist III
Specialist III

Your QlikView load script will be as follows:

LOAD Term,

     If (IsNull(Term),'No Term',

     If (Term <= 12,'0-12',

     If (Term <= 24,'13-24',

     If (Term <= 36,'25-36','37+')))) as term_band,

     ....

FROM TestExcelLoad.xlsx

(ooxml, embedded labels, table is Sheet1);

I tested it and it works.