Sorting documents > Defining sort keys > Sort keys for documents in relational database (Document Broker Plus)

Sort keys for documents in relational database (Document Broker Plus)
If the documents are retrieved from a relational database (Document Broker Plus), you must use metadata associated with the stored documents as sort keys.
Prerequisites
Metadata is defined using document type resources in the Project that stored the documents. To be able to define sort keys in your Project, you must connect the resource set that contains the document type resources to your runtime configuration.
To define a sort key
1
2
Click the Job End icon and select the Document Sort tab.
3
Click Browse. The Browse for Resources dialog box opens.
4
5
6
Metadata name – the metadata name to use as sort key.
Sort order – Ascending or Descending.
7
Defining sort keys using scripts
The DeclareMetadata script function specifies a metadata name to be used for sorting or bundling of documents. The metadata name can then be associated with a variable by for example using the following functions:
SetCurrMetadata – sets the metadata value on the current document.
SetSegMetadata – sets the metadata value on a specified document.
You can then sort the documents in the current segment by using the SortSegDoc script function:
Note:
Example 3
$ret = DeclareMetadata(“zip”, “N”; “A”)
 
Example 4
$doc_id = getFirstSegDoc();
while (num($doc_id) > 0)
{$zip = “1234”
$setSegMetaData($doc_id, “zip”, $zip);
$doc_id = GetNextSegDoc($doc_id);}
 
OpenText StreamServe 5.6 Updated: 2013-03-01