Sorting documents > Defining sort keys > Sort keys for documents in FastObjects database

Sort keys for documents in FastObjects database
If the documents are retrieved from a FastObjects database, you must use metadata associated with the stored documents as sort keys.
To define a sort key
1
2
Click the Job End icon and select the Document Sort tab.
3
4
Key – the metadata ($<metadata>) to use as sort key.
Type – Numeric or String. Must be the same type as defined for the metadata in the document repository.
Sort order – Ascending or Descending.
5
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 Updated: 2013-03-01