Database Functions

Several components of iKnowBase can be configured to use database functions (written in Oracle PL/SQL) for customization. Rather than specify the names of the functions at each use, they are collected in this module.
Database functions come in several flavors, depending on their intended usage scenarios.

Properties

This section describes the properties of a database function, as shown on the corresponding Edit pane.

Property Description
Subsystem

Select the subsystem the profile belongs to

Context

Select the appropriate context for which you want to call the PL/SQL command. Available values are:

  • Event procedure: The function can be used from iKnowBase events only.
  • Form:Custom Show: The function can be used from Forms
  • Form:Custom Save: The function can be used from Forms
  • Parse/build url from a listener url: The function handles build/parse URLs where a listener_url is used on a target. Listener_urls enables functionality for readable URLs.
  • Portlet:Run PL/SQL function: The function can be used from the “Run PL/SQL function” portlet
  • Pres.Style:Database function: The function can be used from presentation styles (advanced and simple)
  • Pres.Style:Format clause: The function can be used to format data from a presentation style
  • Target/Homeplace:Database function: The function can be used from a target and a target selector.
  • Solr – GetDocument: The function can replace the default behavior in ikb_solr.get_document, used by the indexing prosess to SOLR Search Engine.
  • Solr – attribute functions: The function extends the default behavior in ikb_solr.get_document, used by the indexing prosess to SOLR Search Engine. Can be called either pr document or for a single attribute.
  • Tooltip functions: Select a special add link to create tooltip functions.
Name

Type the name of the database function.

PL/SQL Command

Type the PL/SQL command that you want to call from the iKnowBase Oracle database.

Description

Type a description for this database function.

Package/Procedure info

Displays info about the database object like owner, object type, status, created date and last ddl time.

Procedure signature

Displays the signature of the function/procedure.

Database function signatures

Event procedure – document events

<package>.<procedure name> (
    p_event_params 	in 	ot_eventparams,
    p_old_record 	in 	ot_document
); 

Event procedure – user events

<package>.<procedure name> (
    p_event_params 	in 	ot_eventparams,
    p_old_record 	in 	ot_user
); 

Event procedure – group events

<package>.<procedure name> (
    p_event_params 	in 	ot_eventparams,
    p_old_record 	in 	ot_group
); 

Event procedure – acl events

<package>.<procedure name> (
    p_event_params 	in 	ot_eventparams,
    p_old_record 	in 	ot_acl
); 

Event procedure – File upload events

<package>.<procedure name> (
    p_event_params 	in 	ot_eventparams,
    p_old_record 	in 	ot_upload_temp_document
); 

Parse/build url from a listener url

The function names must support two methods: if p_method=BUILD then you will receive a set of values and return the values to be shown in the URL. p_method=PARSE must do the opposite.

Function <function name> (	
    p_method 	in varchar2, 
    p_target_guid in varchar2, 
    p_fragments in ct_portlet_runtime_fragments default ct_portlet_runtime_fragments()) 
  return ct_portlet_runtime_fragments;

Target/Homeplace: Database function

<package>.<procedure name>;

Form:Custom Show

<package>.<procedure name> (
    p_style_id 		in 	number
    p_document_id	in 	number,
    p_parent_id		in 	number,
    p_site_id		in 	number,
    p_reference_path	in 	varchar2,
    p_page_url		in 	varchar2,
    p_back_url		in 	varchar2
);

Form:Custom Save

<package>.<procedure name> (
      p_back_url                 IN VARCHAR2,
      p_site_id                  IN NUMBER,
      p_style_id                 IN NUMBER,
      p_request                  IN VARCHAR2 DEFAULT 'save',
      p_page_url                 IN VARCHAR2 DEFAULT NULL,
      p_document_id              IN NUMBER DEFAULT NULL,
      p_parent_id                IN NUMBER DEFAULT NULL,
      p_document_type_id         IN NUMBER DEFAULT NULL,
      p_title                    IN VARCHAR2 DEFAULT NULL,
      p_acl_id                   IN NUMBER DEFAULT NULL,
      p_url                      IN VARCHAR2 DEFAULT NULL,
      p_description_array        IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_text_array               IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_long_text_ids            IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_long_text_arrays         IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_valid_from               IN VARCHAR2 DEFAULT NULL,
      p_valid_to                 IN VARCHAR2 DEFAULT NULL,
      p_status_id                IN NUMBER DEFAULT NULL,
      p_external_key             IN VARCHAR2 DEFAULT NULL,
      p_file                     IN VARCHAR2 DEFAULT NULL,
      p_document_format          IN VARCHAR2 DEFAULT NULL,
      p_attrib_value             IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_old_attrib_value         IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_attribute_id             IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_line_no                  IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_line_no_ref              IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_external                 IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_dav_external_guid        IN VARCHAR2 DEFAULT NULL,
      p_template                 IN NUMBER DEFAULT NULL,
      p_document_id_ref          IN NUMBER DEFAULT NULL,
      p_attachment               IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_task_guid                IN VARCHAR2 DEFAULT NULL,
      p_task_step_guid           IN VARCHAR2 DEFAULT NULL,
      p_version                  IN VARCHAR2 DEFAULT NULL,
      p_version_no               IN NUMBER DEFAULT NULL,
      p_version_comment          IN VARCHAR2 DEFAULT NULL,
      p_handle_redirect_local    IN BOOLEAN DEFAULT FALSE,
      p_reference_path           IN VARCHAR2 DEFAULT NULL,
      p_session_id               IN VARCHAR2 DEFAULT NULL,
      p_return_type              IN VARCHAR2 DEFAULT NULL,
      p_callback_function        IN VARCHAR2 DEFAULT NULL,
      p_attribute_file_ident     IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_attribute_file           IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_files_guid_remove        IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr,
      p_files_attribute_remove   IN ikb_portal_api.vc_arr DEFAULT ikb_portal_api.empty_vc_arr
      );

Portlet:Run PL/SQL function

<package>.<procedure name>;

Tooltip function (PLSQL)

<package>.<function name>  (
      p_site_id          IN   NUMBER,
      p_document_id      IN   NUMBER,
      p_attribute_id     IN   NUMBER,
      p_page_url         IN   VARCHAR2,
      p_back_url         IN   VARCHAR2,
      p_reference_path   IN   VARCHAR2,
      p_language_id      IN   VARCHAR2,
      p_version_no       IN   NUMBER
   )
      RETURN VARCHAR2

Solr – GetDocument

<package>.<function name>  (
	p_solr_message in ot_solr_message, 
        p_indexerType in varchar2 default 'SOLR') 
    return ct_solr_rows;

Solr – attribute functions

<package>.<Procedure name>  (
	p_document_id 		in number, 
	p_attribute 		in ot_document_attribute default null,
	p_solr_data 		in out ct_solr_rows default ct_solr_rows())
        );

Pres.Style:Database Function (Advanced function)

Advanced function has two variants depending on the datasource in the presentation style. If the datasource is set to DOCUMENT use this signature:

<package>.<function name>  (
    p_site_id          	IN   NUMBER,
    p_document_id      	IN   NUMBER,
    p_attribute_id     	IN   NUMBER,
    p_page_url         	IN   VARCHAR2,
    p_back_url         	IN   VARCHAR2,
    p_reference_path   	IN   VARCHAR2,
    p_language_id      	IN   VARCHAR2
) RETURN VARCHAR2

and if the datasource is VERSIONED_DOCUMENT, this is the correct signature:

<package>.<function name>  (
    p_site_id          	IN   NUMBER,
    p_document_id      	IN   NUMBER,
    p_attribute_id     	IN   NUMBER,
    p_page_url         	IN   VARCHAR2,
    p_back_url         	IN   VARCHAR2,
    p_reference_path   	IN   VARCHAR2,
    p_language_id      	IN   VARCHAR2,
    p_version_no	IN   NUMBER
) RETURN VARCHAR2

A good advice is to use the latest one so it can be used for both datasource. You must then make a test in the function to check if its a version or not you are working with.

Pres.Style:Database Function (Simple function)

Simple functions doesn’t take any parameters (e.g. dbms_random.random).

<package>.<function name> or <sql-function>

Pres.Style:Format Clause

Use an SQL-function like char/date-functions, arithmetic functions or SQL built ins. #value will be substituted with the attribute value. Examples:

to_char(#value,'hh24.mi');
dbms_random.random;

Target/Homeplace: Database function

<package>.<procedure name>;

Register a Database Function

You must register database functions, which will be called through the URL in iKnowBase Page Engine. For Custom Save Functions (used in forms) this will be done automatically for you. If you need to verify/register manually, use the screen for Package Aliases.