Conversion component functions

The Conversion component provides the following configuration functions.

Functions

Description

SelectByStackId,

SelectByChannelName, SelectByOutsourcingPrinterName/ SelectByOutsourcingPrinterOId, SelectByOrganisationalMetadata

Optional. Each call of the Run function processes a single stack from a set of available stacks.

These functions configure which stacks are available.

By default, all streamed stacks are available.

When calling a particular "SelectBy" function more than once, only the last call is taken into account, and the previous calls are silently ignored.

  • SelectByStackId

    Parameter: identifier (BigInteger). Set to a specific stack identifier so conversion only selects the stack with this identifier.

  • SelectByChannelName

    Parameter: name (String, case-insensitive). Set to a specific channel object name so conversion only selects stacks assigned to the channel with this object name.

  • SelectByOutsourcingPrinterName / SelectByOutsourcingPrinterOId

    You can call either of these functions to specify the outsourcing printer, but only the last call is taken into account.

    1. SelectByOutsourcingPrinterName

      Parameter: name (String, case-insensitive). Set to a specific outsourcing printer object name so conversion only selects stacks assigned to the outsourcing printer with this object name.

    2. SelectByOutsourcingPrinterOId

      Parameter: object identifier (String, case-sensitive). Set to a specific outsourcing printer object identifier so conversion only selects stacks assigned to the outsourcing printer with this object identifier.

  • SelectByOrganisationalMetadata

    Set the following parameters to configure conversion to only select stacks that have the given organizational metadata field with the given value.

    1. key (String, runtime database collation1). Set to a specific organizational metadata field.
    2. value (String, runtime database collation). Set to a specific value of this organizational metadata field. The value may not be empty.

Example

The following is an example of a customization of the CCM_DoConversion script.

; Initialize the Conversion component.
	Conversion = ModusProcess.GetComponent("Conversion")
	
	; Pick up the stacks for the channel 'Print', which are printed on 'ColorPrinter', and which do not contain a ContractDocument.
	Conversion.SelectByChannelName("Print")
	Conversion.SelectByOutsourcingPrinterName("ColorPrinter")
	Conversion.SelectByOrganisationalMetadata("HasContractDocument", "no")
	
	; Run conversion.
	StackId = Conversion.ConvertStack()
	If (StackId <> "")
		; Stack found and spool file created. Report success and allow next loop iteration to start.
		Protocol("Successfully created spool file for stack with id " + StackId + ".", 8)
	Else
		; No stack record found. Report and wait before starting the next loop iteration.
		Protocol("No stack record found. Waiting for " + WaitTime + "ms before trying again.", 8)
		Sleep(WaitTime)
	End-If
OnError()
	If (Error.Handled)
		; Stack record found, but error while processing it. Report failure, but still allow next loop iteration to start.
		Protocol("Put stack record " + Error.InputItem + " in error state due to " + Error.Message, 8)
	Else
		; Fatal error. Bail out.
		Raise("UnrecoverableConversionError", Error.Message)
	End-If
End-Try

1 The collation for this and the following parameter is determined by the Batch & Output Management runtime database.