You are on page 1of 2

Resident load is also used to reuse already in-memory loaded tables.

Preload is used to add dimensions and facts to the current table.

Resident Load and Precedent load both are different concepts.

With Resident load you can load the same table any N number of times again and
again.
But with preceding load you can only load one time. Mainly this is been used in
transformation, Calculation, using Qlikview functions with Select query etc.

Example:
LOAD
*,
Year(Transaction_Id) AS Year,
MonthName(Transaction_Id) AS MonthYear,
Week(Transaction_Id) AS Week;
SELECT
Transaction_Id,
Transaction_date
FROM Transaction;

With Preceding it is possible to reload again and again into the same table,
it is not possible to create multiple tables with Preceding reload.

Resident Load:
Temp:
LOAD
*
FROM Data;

Temp1:
LOAD
*
FROM Temp;

Temp2:
LOAD
*
FROM Temp;

But with preceding load


LOAD
*,
If(Previous(MonthYear) <> MonthYear, 1, 0) AS MonthStartFlag; // Second preceding
reload
LOAD
*,
Year(Transaction_Id) AS Year,
MonthName(Transaction_Id) AS MonthYear,
Week(Transaction_Id) AS Week; // First preceding reload
SELECT
Transaction_Id,
Transaction_date
FROM Transaction;

Important Points on preceeding Load


1:Preceeding Load : It is a way for you to define successive transformations and
filters
so that you can load a table in one pass but still have several transformation
steps.

Example: you have a database where your dates are stored as strings and you want to
use the QlikView date
functions to interpret the strings. But the QlikView date functions are not
available in the SELECT statement.
The solution is to put a Load statement in front of the SELECT statement: (Note the
absence of �From� or �Resident�.)

Load Date#(OrderDate,�YYYYMMDD�) as OrderDate;


SQL SELECT OrderDate FROM � ;
Basically it is a Load statement that loads from the Load/SELECT statement below.

2:With preceding Load, you don�t need to have the same calculation in several
places. For instance, instead of writing

Load ... ,
Age( FromDate + IterNo() � 1, BirthDate ) as Age,
Date( FromDate + IterNo() � 1 ) as ReferenceDate
Resident Policies
While IterNo() <= ToDate - FromDate + 1 ;

where the same calculation is made for both Age and ReferenceDate, I would in real
life define my ReferenceDate only once and then use it in the Age function in a
Preceding Load:

Load ..., ReferenceDate,


Age( ReferenceDate, BirthDate ) as Age;
Load *,
Date( FromDate + IterNo() � 1 ) as ReferenceDate
Resident Policies
While IterNo() <= ToDat
Why Use A Preceding Load?

Put simply, a preceding load allows you to use values derived in one part of the
load in the one above it.
To give a simple example, let�s say we are loading two dates from a text file and
we want to know how far apart those days are.
We need to convert those dates from the text values to numeric ones we can do
arithmetic on and only then can we do
the difference calculation.

WHERE, WHILE and GROUP BY are all permissible using values from the load before.
You should probably not use these features often, but it is with knowing they are
there.

Disadvantages:

If you want to use the Order_by clause to sort the records before processing the
LOAD statement.
If you want to use any of the following prefixes, in which cases preceding LOAD is
not supported:
Crosstable
Join
Intervalmatch

You might also like