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: 
upaliwije
Creator II
Creator II

Scripting

I load following data first

Vehicle_No      Value

1                         50000

2                         100000

3                         75000

4                         125000

5                         200000

Then I through a Join load the YEAR_OF_MAKE  of some vehicle. Finally my data look as follows

Vehicle_No      Value        Year_of_Make

1                         50000        2011

2                         100000

3                         75000        2013

4                         125000      2014

5                         200000

Now I want classify the year of make as follows in the load script

YOM

2011

2013

2014

Others   (where there is no year of Make)

Kindly help me to write the script for this

1 Solution

Accepted Solutions
maxgro
MVP
MVP


NewTable:

load

     Vehicle_No,     

     Value       

     if(len(trim(Year_of_Make))>0, Year_of_Make, 'Others') as YOM

resident

     OldTable;


drop table OldTable;



View solution in original post

7 Replies
senpradip007
Specialist III
Specialist III

Try like:

Load

     If(Len(Year_of_Make)<>0, Year_of_Make, 'Others') AS YOM,

     ......

From <>;

senarath
Creator III
Creator III

Hi,

You could also use Is Null function in load script where Qlikview will load null fields as Others.

thanx

ychaitanya
Creator III
Creator III

ALT(Year_Of_Make,'Others') as YOM

jyothish8807
Master II
Master II

Hi Upali,

Try this:

Load

If(Len(trim(Year_of_Make))<>0, Year_of_Make, 'Others') AS YOM,

from ...<>

You can try this also:

if(isnull(Year_of_Make)=-1,'Others',Year_of_Make)

Regards

KC

Best Regards,
KC
maxgro
MVP
MVP


NewTable:

load

     Vehicle_No,     

     Value       

     if(len(trim(Year_of_Make))>0, Year_of_Make, 'Others') as YOM

resident

     OldTable;


drop table OldTable;



Anonymous
Not applicable

you can add in the beginning of your script:

set NullValue='Others';

upaliwije
Creator II
Creator II
Author

TKS ALL