Professional Documents
Culture Documents
1. Renaming / Qualifying
We can rename those fields that are a part of the synthetic key but should not be a
part of the association between the two tables.
2. Removing Fields
We can remove conflicting fields from one of the two tables. To remove a field, we
just erase the corresponding line of code from the Load script.
3.Composite Key
We can create an explicit complex key with the concatenation of all common fields
that actually represent the link between the two tables.
Note: After creating the new complex key, we can remove the conflicting fields from
either table.
Loading data from already loaded Qlikview table is possible using Resident Load.
Transformations and Calculations can be performed in the resident load script.
Loading an existing field or a succeeding table is possible too.
Using Inline Load the user can define their own data and load within Qlikview scritpt.
The Inline data can be defined in the inline Data Wizard / Statement.
Example:
LOAD * INLINE [
A
B
C
];
Manipulating tables
The JOIN statement
The JOIN statement is a prefix to the LOAD statement. It is used to join the table that
is being loaded to a previously loaded table. The two tables are joined using a
natural join, this means that the columns in both tables are compared and the join
is made over those columns that have the same column names. This means that if
multiple columns are shared between tables, the match will be made over the
distinct
combinations of those columns.
IMP : By default, QlikView performs an outer join. This means that the rows for both
tables are included in the resulting table. When rows do not have a corresponding
row in the other table, the missing columns are assigned null values.
Note: When using just the bare JOIN statement, the join will be made to the table loaded
directly before the JOIN statement. If the table to join to was loaded somewhere earlier in the
script, that table can be joined to by supplying its name in parentheses.
The JOIN statement can be prefixed with the statements INNER, OUTER, LEFT, and
RIGHT, which performs an inner, outer, left, or right join respectively. This has the
following results:
INNER JOIN: Only rows that can be matched between both tables will be kept in the
result.
OUTER JOIN: All rows will be kept in the result, rows that do not have a
corresponding value in the other table will get null values for the fields that are
unique to that table. When no prefix is specified, this is the default join type that will
be used.
LEFT JOIN: All rows from the first table and those rows from the second table that
have a corresponding key in the first table, will be included in the result. When no
match is found, null values will be shown for the columns that are unique to the
second table.
RIGHT JOIN: All rows from the second table and those rows from the first table which
have a corresponding key in the second table, will be included in the result. When no
match is found, null values will be shown for the columns that are unique to the first
table.
The KEEP statement works in the same way that the JOIN statement does, with a
small difference. Instead of joining the result in a single table, the KEEP statement
keeps both original tables and filters (keeps) rows in one table based on matching
rows in another table. The same logic for INNER, OUTER, LEFT, and RIGHT KEEP applies
here as did with the JOIN statement.
The CONCATENATE statement is also a prefix to the LOAD statement, but instead of
matching and merging rows between tables, this statement appends the rows of one
table to another table.
Adding comments
The COMMENT statement can be used to add comments to tables and fields. These
comments will be shown when hovering the mouse cursor over table and field names
in various dialogs and the Table Viewer window, and are a very useful aid for
understanding the data.
Storing tables
In an environment with multiple documents, it is very likely that we will want to reuse the same table in different apps. Fortunately, there is an easy way to export a
QlikView table to an external QVD file; the STORE statement.
This tells QlikView to store the table [ABC] into the sub-folder DataFiles\QVDs with the
filename ABC.qvd. The .qvd suffix at the end of the statement tells QlikView to use the
QVD format. The other option is (txt) to store the table in text format.
The first line deletes the table [ABC]. The second line deletes the field [%ABCD]. The
third line also deletes the field [%ABCD], but only from the [ABC] table. If any other
tables contain the same field, those are left unaffected.