Script functions reference > Script functions in alphabetical order > D > DeclareMetadata

DeclareMetadata
Syntax
DeclareMetadata(metadataName[, type, sort_order, behaviour, defaultValue]);
S – String (default)
N – Numeric
A string specifying sorting order if metadata is used to sort documents. You can specify one of the following:
A – Ascending (default)
D – Descending
A string specifying the result of the DeclareMetadata function if metadata is not found for the doucments. You can specify one of the following:
F – Fail (default)
E – Empty
D – Default. See default_value argument.
Specifies the default value used when behaviour is set to default.
Description
Declares metadata that can be used in post-processor scripting. If the specified metadata exists in the post-processor repository, the metadata is retrieved with the documents when they are retrieved from the repository. You can use the declared metadata to get and set metadata on documents.
This function can only be used when enveloping and/ or sorting is enabled. The function must be used at Job Begin scripting level. You cannot use it at the post-processing Job Begin scripting level.
Returns
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 = 41260
   SetSegMetaData($doc_id, "zip", $zip);
   $odc_id = GetNextSegDoc($doc_id);
}
$ret = SortSegDoc("zip");
OpenText StreamServe 5.6 Updated: 2013-03-01