Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How the load script works?

Hi All,

I am new to qlikview. How the below script works.

Open the script editor and go to the FilmsDatabase tab. Can you explain what happens in the load statements related to the loading of the table Films?


Films:

LOAD

*,
Rating as RatingSquare,
Rating as RatingStar,
if(Rating = 5, RGB(103, 167, 202),
if(Rating = 4, RGB(140, 191, 218),
if(Rating = 3, RGB(175, 212, 230),
if(Rating = 2, RGB(186, 218, 233),
if(Rating = 1, RGB(232, 241, 246),
RGB(205, 205, 205)))))) as RatingColor
;

LOAD

FilmID,

    Title,

    Year,

    Ceil(Rating/2) as Rating,

//1 as FilmCount,  

    Length,

    if([Year] > 1,right([Year] - mod([Year], 10), 4) & chr(39) & 's') as Decade

FROM

[..\Database\Films Database.xls]

(biff, embedded labels, table is Films$);

FilmCount:

LOAD DISTINCT

Title,
1 as FilmCount

RESIDENT Films;

Actors:

LOAD FilmID,

    Actor

FROM

[..\Database\Films Database.xls]

(biff, embedded labels, table is Actors$);

Directors:

LOAD FilmID,

    Director

FROM

[..\Database\Films Database.xls]

(biff, embedded labels, table is Directors$);

LengthRange:

LOAD * INLINE [

Length Range, Start, End

< 1hr, 0, 60

1 to 1.5hrs, 61, 90

1.5 to 2hrs, 90, 120

2 to 2.5hrs, 121, 150

3hrs+, 151, 9999

];

IntervalMatchLength:

INTERVALMATCH (Length) LOAD Start, End RESIDENT LengthRange;

Thanks in advance

1 Reply
vishsaggi
Champion III
Champion III

It works like bottom to top. It loads the 2nd Load statement (in Films Table) first and then look for any preceding load, if it finds the preceding load statement will be executed and Films table is created. Preceding load is used as a transformation step when loading data.

Please read this HIC link very useful and informative.

Preceding Load

Thanks,
V.