Script functions reference > Script functions in alphabetical order > S > SortSegDoc

SortSegDoc
Syntax
SortSegDoc(value_1[, value_2,..value_n]);
value_1,..value_N
Description
Sorts the documents in the current segment according to the specified sort keys.
The sorting order is defined by one of the following
the DeclareMetadata() function
When the SortSegDoc() function is used with an envelope key the EnvelNr metadata key should be part of the sort otherwise the envelope definition will not be retained.
The function can be used at the following post-processing scripting levels:
Before job.
Returns
0
num<>0
Example
Job Begin script:
$ret = DeclareMetadata("zip", "N", "A");
Post-processor Job Begin script:
$doc_id = GetFirstSegDoc();
while(num($doc_id) > 0)
{
   $zip = 12345
   SetSegMetadata($doc_id, "zip", $zip);
   $doc_id = GetNextSegDoc($doc_id);
}
$ret = SortSegDoc("zip", "EnvelNr");
 
OpenText StreamServe 5.6 Updated: 2013-03-01