Content viewer

Overview

The figure below gives a quick overview of the models available to the ContentViewer.

Global objects

These are the global (top level) objects available when using FreeMarker from a ContentViewer.

Object Description Type
viewer This object contains information about the viewer, its presentation style and its data. ViewerModel
context This object contains information about the execution context. ContextModel
component This object contains information about the executing component. ComponentModel

ViewerModel

This object contains information about the ContentViewer itself, its definition and data.

Property Description Type
data The full data set of the content viewer. RowSetModel
style The presentation style of the content viewer. StyleSet
logic Logic information about the content viewer. LogicModel
navigation Navigational information about the content viewer. NavigationModel
param URL-parameters. ParameterModel
strings Available strings for the viewer. This TextMapModel supports locations “style”, “viewer” and “domain”. TextMapModel
<default> When used directly, this object evaluates to the value of the “data” property. RowSetModel

RowSetModel

This object contains a set of rows/documents. The top level RowSetModel (as returned from viewer.data) contains all rows/documents returned from the content viewer, whereas RowSetModels accessed differently (for example through row.sub from a specific row) contains only a partial set of documents.

The object is a freemarker sequence model, so you can access the nodes directly using ${data[index]}, or you can traverse it using the ...[/#list] syntax.

The object is also a freemarker node, so you can also use the built-ins ?children, ?parent, ?root, ?ancestors, ?node_name, ?node_type and ?node_namespace. The ?node_name and ?node_type properties are both “DocumentList”.

Property Description Type
isEmpty A flag indicating whether the content viewer returned any rows. Returns true if the viewer is empty. Boolean
count The number of documents on the current level (documentLevel) Number
lastLevel The level of the last document available in this data set. Number
level A sequence containing only documents on this particular level, e.g. without subdocuments. This is the default, so it can be skipped. Sequence(Row)
recurse A sequence containing both documents on this level and all subdocuments. Sequence(Row)
style The presentation style of the current level of the ContentViewer. StyleSet
?children List of documents List of RowModel
?parent There is no parent; it always returns null. Null
?root There is no root node; it always returns null. RowModel
?ancestors List of ancestors List of RowModel
?node_namespace There is no namespace; it always returns null. Null
?node_type Always the string “DocumentList” String
?node_name Always the string “DocumentList” String
<default> When used directly, the rowset object evaluates to a sequence of Row-objects. Sequence(Row)
<name> The data field object for a given field. The field name refers to “reference name” from the presentation style definition. The type of the property varies, depending on the data type of the data field. DataFieldXxx

RowModel

This model object contains information about a single row / document returned from the viewer.

The model is a freemarker node, so you can also use the built-ins ?children, ?parent, ?root, ?ancestors, ?node_name, ?node_type and ?node_namespace.

Note that part of the information is context sensitive. For example, a document might be the second document in the collection data.viewer.level (and thus have isOdd=false), while also being available as the third document in the collection data.viewer.recurse (and thus have isOdd=true).

Property Description Type
fields The fields (attributes) from a single row/document in the data set of the ContentViewer. DataFields
documentLevel The level of the current document. Number
documentId The documentId of the current document. Number
isOdd The current document is on an odd row number (1,3,5,...) Boolean
isFirst The current document is the first in the result set. Boolean
isLast The current document is the last in the result set. Boolean
sub A collection of sub documents from the current document. RowSetModel
document The returned document, without attributes DocumentModel
?children List of children documents List of RowModel
?parent Parent node RowModel
?root Root node RowModel
?ancestors List of ancestors List of RowModel
?node_namespace There is no namespace; it always returns null. Null
?node_type Always the string “Document” String
?node_name Always the string “Document” String
<default> When used directly, this object evaluates to the “fields” property.
<name> The data field object for a given field. The field name refers to “reference name” from the presentation style definition. The type of the property varies, depending on the data type of the data field. DataFieldXxx

DocumentModel

This object represents an iKnowBase document. The structure of the DocumentModel is more or less the same as the “Document” object in the ServiceAPI.

Note that this model may not be fully populated. In particular, the various ObjectReferences will probably only contain an id or a guid, and the list of attributes is often not present.

Property Description Type
documentReference Document identity, with id, guid and externalKey ObjectReferenceModel
title Document title (same as documentReference.label) ObjectReferenceModel
description Document description (ingress) String
aclReference Reference to acl ObjectReferenceModel
documentTypeReference Reference to document type ObjectReferenceModel
ownerReference Reference to document owner UserReferenceModel
parentReference Reference to parent document ObjectReferenceModel
statusReference Reference to document status ObjectReferenceModel
validFrom “Valid from” attribute of document Date
validTo “Valid to” attribute of document Date
created Created-time of document Date
createdBy Reference to user who created document (same as owner) Date
updated Updated-time of document Date
updatedBy Reference to user who made last update to document Date
filename Filename of document content, if it is a file String
url URL stored on document, if it is an URL String
isFile Indicates whether the document content is a file Boolean
isUrl Indicates whether the document content is an URL Boolean
isText Indicates whether the document content is text (plain or html) Boolean
isXml Indicates whether the document content is XML Boolean

DataFields

This object is a FreeMarker “hash” container containing the data fields for a given document in the ContentViewer. The object can be accessed by field name, as defined in the presentation style defintion.

Property Description Type
<name> The data field object for a given field. The field name refers to “reference name” from the presentation style definition. The type of the property varies, depending on the data type of the data field. DataFieldXxx.

DataFieldString

This object contains the data field of type String.

Property Description Type
char The unformatted string value of the field. String
html The formatted html value of the field. String
text The formatted html value of the field (deprecated for “.html”) String
label The label value of the field String
attribute The attribute behind the field, or null if there is no attribute AttributeModel
externalKey (Deprecated, use attribute.externalKey) String
hasValue A boolean indicating whether the value is specified and not blank. Boolean
style The style specification for this particular data field. Style
xml For non-system attributes, return the string value as a parsed XML Node object. XML
url For system attributes that represent a link, this returns the value of the “href” attribute of the <a>-tag. String
onclick For system attributes that represent a link, this returns a javascript-statement that can be used to follow the link. The onclick event must be attached to an <a>-tag, since the returned statement refers to the containing <a>-tag. String
script This property is deprecated; use the onclick-property instead. String
nodeText (Deprecated) For system attributes that return a link, this returns the text elements inside the <a>-tag. String
nodeValue (Deprecated) For system attributes that return a link, this returns the text elements inside the <a>-tag. String
<default> When used directly, this object evaluates to the “text” property. String

DataFieldNumber

This object contains the data field of type Number.

Property Description Type
number The number value of the field. Number
char The unformatted string value of the field. String
html The formatted html value of the field. String
text The formatted html value of the field (deprecated for “.html”) String
label The label value of the field String
attribute The attribute behind the field, or null if there is no attribute AttributeModel
externalKey (Deprecated, use attribute.externalKey) String
hasValue A boolean indicating whether the value is specified and not blank. Boolean
style The style specification for this particular data field. Style
<default> When used directly, this object evaluates to the “number” property. Number

DataFieldDate

This object contains the data field of type Number.

Property Description Type
date The date value of the field. Date
char The unformatted string value of the field. String
html The formatted html value of the field. String
text The formatted html value of the field (deprecated for “.html”) String
label The label value of the field String
attribute The attribute behind the field, or null if there is no attribute AttributeModel
externalKey The external_key specified for the attribute behind the field String
hasValue A boolean indicating whether the value is specified and not blank. Boolean
style The style specification for this particular data field. Style
<default> When used directly, this object evaluates to the “date” property. Date

DataFieldClob

This object contains the data field of type Clob.

Property Description Type
char The unformatted string value of the field. String
html The formatted html value of the field. String
text The formatted html value of the field (deprecated for “.html”) String
label The label value of the field String
attribute The attribute behind the field, or null if there is no attribute AttributeModel
externalKey The external_key specified for the attribute behind the field String
hasValue A boolean indicating whether the value is specified and not blank. Boolean
style The style specification for this particular data field. Style
<default> When used directly, this object evaluates to the “text” property. String

DataFieldFiles

This object contains the data field of type Files, e.g. where the value is one or more files. This is of course used for attachments, but also for derived image formats (such as thumbnails) for image documents.

Property Description Type
char The unformatted string value of the field. String
html The formatted html value of the field. String
text The formatted html value of the field (deprecated for “.html”) String
label The label value of the field String
attribute The attribute behind the field, or null if there is no attribute AttributeModel
externalKey The external_key specified for the attribute behind the field String
hasValue A boolean indicating whether the value is specified and not blank. Boolean
style The style specification for this particular data field. Style
... Any other property maps to the same property on the first File, so that ${file.xxxx} maps to {file 0 .xxx} ...
[] This object is a sequence of DataFieldReference objects. DataFieldReference
<default> When used directly, this object evaluates to the “text” property. String

DataFieldFile

This object represents a File value.

Property Description Type
url The URL of the file content String
mimetype The mimetype of the file, if known String
filename The filename of the file, if known String

DataFieldReference

This object contains an ObjectReference, e.g. a reference to an object in the iKnowBase repository. Exactly what is being pointed to cannot be found from this object; this must be derived from the context (such as the containing attribute): A value list attribute would contain a reference to a value list, while a dimension attribute would contain a reference to a dimension.

Property Description Type
label The label value of the reference String
objectId The ID of the reference Number
objectGuid The guid of the reference String
externalKey The external key of the reference String

DataFieldReferences

This object contains the data field of type References, e.g. where the value is one or more
references to external objects (value lists, dimensions, etc).

Property Description Type
char The unformatted string value of the field. String
html The formatted html value of the field. String
text The formatted html value of the field (deprecated for “.html”) String
label The label value of the field String
attribute The attribute behind the field, or null if there is no attribute AttributeModel
externalKey The external_key specified for the attribute behind the field String
hasValue A boolean indicating whether the value is specified and not blank. Boolean
style The style specification for this particular data field. Style
... Any other property maps to the same property on the first Refernce ...
[] This object is a sequence of DataFieldReference objects. DataFieldReference
<default> When used directly, this object evaluates to the “text” property. String

DataFieldAction

This object represents a single action, typically represented as a HTML <a>-tag.

Property Description Type
label The label value of the action String
url The URL of the action, used as the “href” attribute of the <a>-tag. String
onclick The value of the “onclick” attribute of the <a>-tag. String
script The value of the “onclick” attribute of the <a>-tag. String

DataFieldUserAction

This object is an extension of the DataFieldAction-object, and represents an action that applies to a specific user. In addition to the action information in the DataFieldAction-object, you can also find information about the referred user:

Property Description Type
label The label value of the action String
url The URL of the action, used as the “href” attribute of the <a>-tag. String
onclick The value of the “onclick” attribute of the <a>-tag. String
script The value of the “onclick” attribute of the <a>-tag. String
reference The user referenced by this action UserReference

DataFieldObjectAction

This object is an extension of the DataFieldAction-object, and represents an action that applies to a specific object. In addition to the action information in the DataFieldAction-object, you can also find information about the referred object; the type of the object should be apparent from the type of the field:

Property Description Type
label The label value of the action String
url The URL of the action, used as the “href” attribute of the <a>-tag. String
onclick The value of the “onclick” attribute of the <a>-tag. String
script The value of the “onclick” attribute of the <a>-tag. String
reference The object referenced by this action ObjectReference

DataFieldDocumentAction

This object is an extension of the DataFieldAction-object, and represents an action that applies to a specific document. In addition to the action information in the DataFieldAction-object, you can also find information about the referred object:

Property Description Type
label The label value of the action String
url The URL of the action, used as the “href” attribute of the <a>-tag. String
onclick The value of the “onclick” attribute of the <a>-tag. String
script The value of the “onclick” attribute of the <a>-tag. String
reference The document referenced by this action DocumentReference

DataFieldActions

This object is used for data fields that represent multiple actions, for example when retrieving document and image links.

Property Description Type
char The unformatted string value of the field. String
html The formatted html value of the field. String
text The formatted html value of the field (deprecated for “.html”) String
label The label value of the field String
attribute The attribute behind the field, or null if there is no attribute AttributeModel
externalKey The external_key specified for the attribute behind the field String
hasValue A boolean indicating whether the value is specified and not blank. Boolean
style The style specification for this particular data field. Style
[] This object is a sequence of DataFieldAction objects. DataFieldAction, DataFieldUserAction, DataFieldObjectAction or DataFieldDocumentAction
<default> When used directly, this object evaluates to the “text” property. String

Note that the Actions (plural) object typically will return HTML corresponding to all of the linked objects, while you can access each individual link through the sequence operator. Also, detailed information about the referenced object (such as the object label / document title) is only available by referencing the individual objects.

AttributeModel

This object contains information about a defined attribute. Most DataField model objects have a reference to an AttributeModel object.

Property Description Type
objectId The ID of the attribute Number
objectGuid The guid of the attribute String
level The level of the attribute Number
label The text of the attribute String
name The name of the attribute String
datatype The data of the attribute, as defined in the iKnowBase ServiceAPI. (DATE, NUMBER, CHAR, CLOB, DIMENSION, VALUELIST, DOCUMENT_LINK, PICTURE_LINK, EXTERNAL, DOCUMENT_FIELD or FILE). String

StyleModel

This object contains the presentation style definition for a ContentViewer, or for a specific level inside the Content Viewer.

Property Description Type
fields The fields defined inside a presentation style StyleFields
hasQuickLink A boolean indicating whether there are quicklinks Boolean
quickLink A list of quicklinks TemplateSequenceModel
portletTitle The title of the portlet String
<default> When used directly, this object evaluates to the “fields” property.
<name> The StyleField object for a given field. The field name refers to the “reference name” from the presentation style definition. StyleField

QuickLinkModel

This object represents a quick link, as defined in a ContentViewer.

Property Description Type
text The full html value of the quicklink, e.g. the full <a>-tag including attributes and content. String
label The label value of the field String
url The URL to the quick link target String
onclick The value of the “onclick” attribute of the <a>-tag. String
script The value of the “onclick” attribute of the <a>-tag. String
nodeText (Deprecated) The text elements inside the <a>-tag. String
nodeValue (Deprecated) The text elements inside the <a>-tag. String

StyleFields

This object is a FreeMarker “hash” container containing the field specifications for a given presentation style. The object can be accessed by field name, as defined in the presentation style defintion.

Property Description Type
<name> The style field object for a given field. The field name refers to “reference name” from the presentation style definition. Note that the StyleField may also be reached through the “style” property on the DataField objects. StyleField

StyleField

This object contains the properties defined on a single field in a presentation style.

The term “next sorting” is used to indicate that the property adapts to current state: If the field is not sorted, it returns a value suitable for ascending sort; if the field already has ascending sort, it returns a value suitable for descending sort; finally, if it already has descending sort, it returns a value suitable for ascending sort.

Property Description Type
label The label value of the presentation style field. String
externalKey The external_key specified for the attribute behind the field. String
isSortActive Indicator to whether any sort is active for the field Boolean
isSortActiveAscending Indicator to whether ascending sort is active for the field Boolean
isSortActiveDescending Indicator to whether descending sort is active for the field Boolean
sortAction A clickable action for “next sorting”. HtmlLink
sortActionAscending A clickable action for ascending sorting HtmlLink
sortActionDescending A clickable action for descending sorting HtmlLink
sortIconActive HTML image tag displaying icon for currently active sort, if any. String
sortIconAscending HTLM image tag displaying either active or passive icon for ascending sort. String
sortIconDescending HTLM image tag displaying either active or passive icon for descending sort. String
sortLabel Deprecated, use “sortAction” instead. HtmlLink
sortIconAsc Deprecated, use “sortIconAscending” instead. String
sortIconDesc Deprecated, use “sortIconDescending” instead. String

Logic

This object contains the set of fields defined in the presentation style

Property Description Type
languageId The languageId of the viewer. String
noRecordsFound The text to display if the viewer does not return any rows. String
currentDate Deprecated; use top level ContextModel instead (${context.date}). Date
dbExecute Directive that runs a plsql-block and returns the returned HTP-content. String

Example:

[@viewer.logic.dbExecute]
BEGIN
    HTP.prn ('<div>');
    HTP.prn ('You are currently connect to instance number ' || DBMS_UTILITY.CURRENT_INSTANCE);
    HTP.prn ('</div>');
END;
[/@viewer.logic.dbExecute]

This object contains information supporting navigation in the viewer.

Property Description Type
pageSize The number of rows defined to show on each page. Number
firstRow Index of the first row. Number
lastRow Index of the last row in the current data set (current page). Number
totalRows Total number of rows available to the viewer, even after navigation, if available. Number
startRow The first row requested (even though it may not actually exist). Number
maxRow Max number of rows to return by the viewer. Number
isEmpty True if there is no navigation bar. Boolean
text HTML of the entire navigation bar String
range The current navigation range (#-# of #) String
first Link to the first page of the viewer NavigationLink
previous Link to the previous page of the viewer NavigationLink
next Link to the next page of the viewer NavigationLink
last Link to the last page of the viewer NavigationLink
goto One or more links to specific row numbers GotoModel
showMore A link to the “show more” target defined for the viewer. HtmlLink
moreLink This property is deprecated; use “showMore” instead. String

GotoModel

This object is a method model that lets you generate links to specific row numbers. As the object is a method, you call it using a method syntax as shown below.

Signature Description Type
(start) Generate a single link NavigationLink
(start, pagesize) Generate a single link NavigationLink
(start, interval, count) Generate a list of links Sequence of NavigationLink

To generate a simple link, use the syntax with a single argument:

Argument Description Type
start Row number to generate link to Number

To generate a link that both navigates to a specific row and sets the page size, use the syntax with two arguments:

Argument Description Type
start Row number to generate link to Number
pagesize Number of rows per page Number

To generate a list of links, use the syntax with three arguments. The method will return a list of links, useful for generating navigating bars with many links, for many pages:

Argument Description Type
start Row number to generate link to Number
interval Interval between links Number
count Number of links to generate Number

The list method will not return any illegal links. If you request goto(50,10,10), you are asking for 10 links to rows 50, 60, 70 ... 140. However, the method will not return links beyond the last record, so if the viewer has only 65 records, you would get two links only, to rows 50 and 60.

The list method will also allow you to generate links “backwards”, using a negative interval. goto(50,-10,10) will generate ten links 10 record intervals, up to row 50. Since it will not generate illegal links, this will in fact return five links: 10,20,30,40 and 50.

Examples:

<!-- To generate a single link to row number 50 -->
${viewer.navigation.goto(50)}
<!-- To generate five links before "this row", then "this row", then five links after -->
[#list viewer.navigation.goto(viewer.navigation.firstRow-10, -10, 5) as link]${link}[/#list]
${viewer.navigation.goto(viewer.navigation.firstRow)}
[#list viewer.navigation.goto(viewer.navigation.firstRow-10, +10, 5) as link]${link}[/#list]

This object represents a single html link.

When used directly, the HtmlLink returns a string with the full link ( <a>...</a>);

Property Description Type
label Localized text to use for the link text String
url The URL of the action, used as the “href” attribute of the <a>-tag. String
onclick The script to be used for the “onclick” attribute for an <a>-tag String
script The script to be used for the “onclick” attribute for an <a>-tag String
target The name of the html target (window) for an <a>-tag String
<default> The complete link element (( <a>...</a>) String

This object represents a single navigation link.

When used directly, the NavigationLink returns a string with the full link ( <a>...</a>);

Property Description Type
label Localized text to use for the link text String
url The URL of the action, used as the “href” attribute of the <a>-tag. String
onclick The script to be used for the “onclick” attribute for an <a>-tag String
startRow The first row to be displayed if the link is followed. String
isValid A value indicating whether a link is valid or not. Boolean
<default> The complete link element (( <a>...</a>) String

An invalid link has a start row outside the legal range. Both previous, next and last can return in invalid links, for example if you try to refer to the “previous” value when already on the first page. An invalid link has startRow set to null, url and onclick set to null, while the label contains the proper value.