21.01.2013 Views

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

'Predecessor' as Relation2<br />

from presdnts where No > 1;<br />

The presidents example is just one simple example of how to use semantic links. These can also be used in<br />

genealogy, where the semantic links can be e.g. cousin, sibling, grandmother, etc. or for people in companies<br />

where the semantic links can be e.g. superior, reports to, secretary, etc.<br />

Example: Using the related values as relation names<br />

Sometimes it is more descriptive to use the related field value as name of the relation. In the case of the presidents,<br />

you may want all the predecessors in one column and all the successors in another:<br />

To create these links, the following script is needed:<br />

Load<br />

No as DuplicateOfNo,<br />

FirstName & ' ' & LastName as Name,<br />

*<br />

from presdnts.csv;<br />

Semantic Load<br />

No -1 as No,<br />

FirstName & ' ' & LastName as Successor,<br />

No as DuplicateOfNo,<br />

'Dummy1'<br />

from presdnts.csv where No > 1;<br />

Semantic Load<br />

No +1 as No,<br />

FirstName &' ' & LastName as Predecessor,<br />

No as DuplicateOfNo,<br />

'Dummy2'<br />

from presdnts.csv;<br />

When a semantic link is clicked, a selection is made in the field of the third column, DuplicateOfNo, which<br />

in the semantic table is always the number of the president shown on the semantic link.<br />

It may not be obvious at first, but the inverse relations in the above construction are almost useless. They<br />

would show a name of a president and, when clicked, select the predecessor/successor of the shown president.<br />

This is why they are called Dummy1 and Dummy2 and only the first relation (column two) is used.<br />

Since we do not want the dummy relations to appear in the list boxes, we must treat the second and fourth<br />

columns as different types of relations. This means that the first and third columns must have different field<br />

384

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!