External Data sources

The iKnowBase Viewer, the component responsible for presenting information from iKnowBase, is capable of displaying content not only from the iKnowBase content store, but also from other database tables. The mechanism for this is the external data source.

You define an external data source with the source table(s), columns, permanent conditions, and potential parameters. You define it as a standalone data source, or as dependent data source, e.g. a data source which is joined with the iKnowBase document table.

In order to use an external data source, you must first create a presentation style. In this presentation style you select the external data source, which will give you access to the columns defined in the external data source. These columns will be available as attributes and can be presented with the same flexibility as iKnowBase attributes. Then you must create a viewer or a search source, and set it up to use the presentation style for the external data source. This will give you access to the parameters defined for the external data source. The parameters will be available as attributes which you may use to build the where condition. The extracts made by using this viewer or search source will be based on the external data source.

Properties

This section describes the properties of an external data source, as shown on the corresponding Edit pane tabs.

Edit tab

Property Description
Subsystem

Select the appropriate subsystem.

Name

Type a name for the external data source.

Description

Type a description for this external data source.

Standalone

Click the appropriate option to join the search source with the iKnowBase table document or make it independent.

For example, if you want a list that shows how many times a document has been read, you can join it with the document table. You are then dependent on specifying a value in tables and where-condition that joins with the document table.

If you want a list outside a document context, for example a list of all users, you can click Yes and specify the table for users in the table-field.

Table(s)

Type the names of the tables that are a part of the external datasource. If you select more than one, you have to join these with each other in the Where-condition.

You can also define functions that are executed within the condition. The function must return a value. Functions are specified within curly brackets: { functionName}.

Note: The execution is done only once, rather than one time per document that are extracted, and might be smart regarding performance.

For example:

ikb_user iu1,
(select count(*) number, site_id, user_id, document_id
from log_documents ld1
where ld1.action=3 group by site_id, user_id, document_id ) ld1
Where condition

Type the where condition to join the tables that are selected for extraction.

If you select the Standalone option as No, join the document table with the prefix oi1.

You can enter SITE_ID, LANGUAGE USER_ID with the meta tags #SITE_ID#, #LANGUAGE# and #USER_ID#/#USERID# .

You can also define functions that are executed within the condition. The function must return a value. Functions are specified within curly brackets: { functionName}.

Note: The execution is done only once, rather than one time per document that are extracted, and might be smart regarding performance.

For example:

and ld1.document_id = oi1.document_id 
and ld1.site_id = oi1.site_id
and iu1.id = ld1.user_id
and iu1.id = #USER_ID#

These where-conditions are in synchronization with the example stated in the Table(s) property.

Columns Tab

Property Description
Create new

Click the Create new link to create a new column.

The list below the Create new link displays the links corresponding to existing columns.

Note: To view and edit a column, click on the respective link. To remove a column, click on the respective icon.

Type

Displays the type as Columns.

Name

Type a name of the column.

When this external data source is used with a presentation style component, the columns defined for the external data source will be available as attributes in the presentation style.

Description

Type a description for this column.

External column or function

Type the database name of the column or function.

Note: Remember to prefix the names.

Parameter Tab

Property Description
Create new

Click the Create new link to create a new parameter.

The list below the Create new link displays the links corresponding to existing parameters.

Note: To view and edit a parameter, click on the respective link. To remove a parameter, click on the respective icon.

Type

Displays the type as Parameter.

Name

Type a name of the parameter.

The parameters defined for the external source will be available as attributes in viewers and search sources that are configured to use a presentation style which uses this external data source.

Description

Type a description for this parameter.

Alias

Type a name that is used in the URL.

Data Type

Click the appropriate data type.

List of Values

Type the SQL expression to build up value lists in a search filter. Use the following syntax for the SQL expression:

Select <idfield>, <description> from <table>

Example:

select msg1.name, msg1.display_name
from owf_mgr.wf_messages_tl   msg1
where msg1.type     = 'KT'
and   msg1.language = 'N'
order by msg1.display_name
Condition or Columns

Type the condition to be built.

#COND# is used when the user want to choose which condition (such as equal or different from) the search will be run as, while #PARAM# specifies the value the user enters.

Note: The condition must start with AND as it is joined with the rest of the where condition.

Example:

and not1.message_name #COND# #PARAM#

Test query tab

This page will run the query defined for the external datasource. If it succeeds it will display the first 30 rows. If if fails, it will display the error message so you can fix the errors.

Property Description
Query

Displays the query.

Result

Displays the result of the query.