Sorting and bundling scripts

Sorting and bundling scripts
You can retrieve data about the documents that will be sorted and bundled. For example you can retrieve metadata for a document, the number of sheets in a document, or the number of documents in an envelope. This information can be used as criteria for different processing options for the documents in a specific segment. For example, you can add or skip a specific page depending on the invoice number, or split the input job into two output files, where each file contain documents with a specific range of number of pages.
For an example of how to divide output depending on number of pages in the documents, see Example 1
Retrieving information about documents
You retrieve data about the documents by using document sorting and bundling scripting functions. For example:
GetPPMetadata – returns the value of a metadata for a specific document, for example the invoice number.
GetSegMetadata – returns the value of a metadata for a specific document within the segment, for example the invoice number.
GetPPDocProperty – returns the value of a specified property for a document, for example the number of logical pages in the document.
GetEnvelNr – returns the envelope number that a document is included in.
GetSegment – returns the segment number that a document and an envelope are included in.
IsFirstPageInEnvelope – returns information about whether or not the current page is the first page in the envelope.
Taking action based on the retrieved information
You can perform actions on the documents or parts of the documents using scripting functions. For example:
NextPage – skips the rest of the current page and processes next page.
NextProc – skips the rest of the current Process, and processes the next Process.
NextDoc – skips the rest of the current document and processes the next document.
NextSegment – skips the rest of the current segment and processes the next segment.
InsertPage – inserts a page in the current document.
FlushOutput – sends parts of the job to the output connector even if the job is not completed.
SetDestPath – sets a destination path, and optionally, a file name.
To add a document sorting and bundling script, see Adding a document sorting and bundling script.
For more information on document sorting and bundling scripting functions, see the Scripting reference.
Example 1
$doc_index = GetFirstDoc();
$PageCount = 0;
while(num($doc_index) > 0)
{$PageCount = num($pageCount) + num(GetPPDocProperty($doc_index, "pages"));
$doc_index=GetNextPPDoc($doc_index);}
if(num($PageCount) > 5)
{$filename = "./out/big.pcl";}
else
{$filename = "./out/small.pcl";}
 
OpenText StreamServe 5.6 Updated: 2013-03-01