Sorting documents > Defining sort keys

Defining sort keys
You use metadata associated with the stored documents as sort keys.
Prerequisites
For documents retrieved from a document repository, metadata must be defined using document types in the Project that stored the documents.
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 1
$ret = DeclareMetadata(“zip”, “N”; “A”)
 
Example 2
$doc_id = getFirstSegDoc();
while (num($doc_id) > 0)
{$zip = “1234”
$setSegMetaData($doc_id, “zip”, $zip);
$doc_id = GetNextSegDoc($doc_id);}
 
OpenText StreamServe 5.6.2 Updated: 2018-01-26