The preceding LOAD feature allows you to load a table in one pass, but still define several successive transformations. Basically, it is a LOAD statement that loads from the LOAD or SELECT statement below, without specifying a source qualifier such as From or Resident that you would normally do. You can stack any number of LOAD statements this way. The statement at the bottom will be evaluated first, then the statement above, and so on until the top statement has been evaluated.
You can achieve the same result using Resident, but in most cases a preceding LOAD will be faster.
Another advantage of preceding load is that you can keep a calculation in one place, and reuse it in LOAD statements placed above.
Example 1: Transforming data loaded by a SELECT statement
If you load data from a database using a SELECT statement, you cannot use QlikView functions to interpret data in the SELECT statement. The solution is to add a LOAD statement, where you perform data transformation, above the SELECT statement.
In this example we interpret a date stored as a string using the QlikView function Date# in a LOAD statement, using the previous SELECT statement as source.
Example 2: Simplifying your script by reusing calculations
In this example we use a calculation more than once in the script:
By introducing the calculation in a first pass, we can reuse it in the Age function in a preceding LOAD: