Data Navigation

Release 1.0 - ...

Data Navigation is a new way in Smartsite iXperion to navigate through your data structures. Site builders can use Data Navigation in the itemdata macro and viper to navigate from a field of a CMS item to related fields. Data Navigation uses relations defined between database columns to navigate through your database.

Data Navigation checks if the asked data is available in the fields of the current item. If the value of a content type field is requested, that value is returned immediately because it is available in memory. If a Data Navigation path is specified that uses data from other database tables, an sql query is constructed and executed to retrieve the requested data.

Examples

Let's start with some Data Navigation examples.

Sxml Output
<se:itemdata field="ContentType" /> Returns the content type number of the current item.
<se:itemdata field="Contents.ContentType" /> Returns the content type number of the current item.
<se:itemdata field="Contents.ContentType.Code" /> Returns the content type code of the current item.
<se:itemdata field="Contents.Parent.ContentType.Code" /> Returns the content type code of the parent of the current item.
<se:itemdata field="FileType" /> Returns the number of the FileType of the current item.
<se:itemdata field="FileType.Nr" /> Returns the number of the FileType of the current item.
<se:itemdata field="FileType.Code" /> Returns the FileType code of the current item.
<se:itemdata field="FileType.nrMimeType" /> Returns the MimeType number of the FileType of the current item.
<se:itemdata field="FileType.nrMimeType.Name" /> Returns the MimeType name of the FileType of the current item.
<se:itemdata field="Parent.Title" /> Returns the title of the parent of the current item.
<se:itemdata field="Parent.Parent.Title" /> Returns the title of the parent of the parent of the current item.
<se:itemdata field="Parent.Parent.Parent.ContentType.nrDefaultWorkflow.Title" /> Returns the title of the default workflow of the content type of the parent of the parent of the parent of the current item.
<se:itemdata field="UserId.LoginName@vwUsers" /> Returns the loginname of the user of the current item.
<se:itemdata field="UserId.*@Users" /> Returns a DataTable containing a record with all the columns of the Users table of the user of the current item.
<se:itemdata field="UserId.PrimaryGroupId@Users.Name" /> Returns the name of the primary User Group of the user of the current item.
<se:itemdata field="UserId.Nr@Users=>Usergroups.Name" /> Returns a DataTable containing the names of all the User Groups to which the user of the current item belongs.
<se:itemdata field="UserId.Nr@Users=>Usergroups=>UserRoles" /> Returns a DataTable containing all the columns of all the User Roles that are assigned via the User Groups to the user of the current item.

Syntax

A Data Navigation path contains one or more segments that are combined using the dot (.) operator and the => operation. The dot operator follows a many to one relation in the database, the => follows a many to many relation in the database. The @ operator tells Data Navigation to not use the many to one relation in the database but instead use the primary key of the database table that follows the @ operator. It is the responsibility of the Data Navigation path writer to make sure the selected value has the same meaning as the primary key of the explicitly selected database table.

In the examples above, the first segment is either the name of a content type field or the name "Contents" which is the primary table in your item's DataSet. If the first segment cannot be mapped to a table in your item's DataSet, it is assumed that you mean the table "Contents" in your DataSet, so the paths "Contents.Title" and "Title" point to exactly the same value since the part "Contents." is optional because there is no conflict.

In the example <se:itemdata field="Contents.Parent.ContentType.Code" /> Data Navigation starts with the parent field, which is a field in your content type. In the database, the column "Contents.Parent" has a one to many to on the "Contents.Nr" database column, basically another record in the database table "Contents". This record in turn, has a database column ContentType that has a many to one relation on "ContentTypes.Nr" database column, so now the Data Navigator is looking at a record in the database table "ContentTypes". Finally the value in the column "code" of the selected record in the database table "ContentTypes" is returned.

In the example <se:itemdata field="UserId.LoginName@vwUsers" />  the Data Navigation start with the UserId of the current item. Since a UserId can exist in either the database table "Users" or in the database table "Visitors", there is no relation at database level. We force a relation to the database view with the @ operator. So we take value of the field UserId and look it up in the primary key column of the database view "vwUsers" and return the value in the column "LoginName".