Stacking component functions

The Stacking component provides the following configuration functions.

Functions

Description

SelectByOrganisationalMetadata

SelectByEnvelopeId

SelectByPostageName

SelectByChannelName

SelectByOutsourcingPrinterOId

SelectAtMost

Optional. These functions configure which envelopes are selected for stacking. By default, all available envelopes are selected.

SortByXPath

SortByXPathDesc

Optional. These functions define criteria used for sorting envelopes when they are combined into a stack. By default, envelopes are not sorted, and the order of envelopes in a stack is undefined.

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

  • SelectByOrganisationalMetadata

    Set the following parameters to configure stacking to only select the communications that have the given organisational metadata field with the given value.

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

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

  • SelectByPostageName

    Parameter: name (String, runtime database collation). Set to a specific postage class name so stacking only selects envelopes assigned to the postage class with this name.

  • SelectByChannelName

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

  • 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.

  • SelectAtMost

    Parameter: count (Integer). Set to a specific number so stacking selects at most this number of envelopes. If there are more envelopes available, it is not determined which ones are selected. If there are remaining envelopes, you need to call the CCM_Stacking process again.

  • SortByXPath

    Parameter: xpath (String, case-sensitive). Set to a specific XPath expression so stacking sorts envelopes when they are combined into a stack. The envelopes are sorted based on values computed by evaluating the XPath expression on the XML serialization of the envelopes according to the CcmBomStackingInput XSD. The sender and recipient in the XML serialization are taken from the first communication that ended in the envelope.

    The computed values are interpreted as text and are compared using case-sensitive ordinal sorting rules. Sorting criteria specified by SortByXPath result in a sort in ascending order.

  • SortByXPathDesc

    Parameter: xpath (String, case-sensitive). Set to a specific XPath expression so stacking sorts envelopes when they are combined into a stack. Sorting criteria specified by SortByXPathDesc result in a sort in descending order.

    The envelopes are sorted based on values computed by evaluating the XPath expression on the XML serialization of the envelopes according to the CcmBomStackingInput XSD. The sender and recipient in the XML serialization are taken from the first communication that ended in the envelope.

    The computed values are interpreted as text and compared using case-sensitive ordinal sorting rules.

    You can call SortByXPath and SortByXPathDesc more than once to specify multiple sorting criteria. When sorting, the criteria is evaluated in the order in which they are specified.

    A case-sensitive ordinal comparison method indicates that string comparison must use successive Unicode UTF-16 encoded values of the string (code unit by code unit comparison). This sorting method is culture invariant.

Example

The following is an example of a customization of CCM_DoStacking, which consists of two scripts that must be called separately.

Script 1

; Initialize the Stacking component.
Stacking = ModusProcess.GetComponent("Stacking")

; Create stacks for all envelopes with high priority.
; Repeatedly stack at most 10 envelopes at the time, until all have been stacked.
Done = false
While (not Done)
                Stacking.SelectByOrganisationalMetadata("Priority", "High")
                Stacking.SelectAtMost(10)
                Stacking.SortByXPath("ccm:Recipient/ct:Zipcode")
                StackCount = Stacking.Run()
                Protocol("Stacking created " + StackCount + " high priority stack(s).", 5)
                If (StackCount = 0)
                                Done = true
                End-If
End-While

Script 2

; Initialize the Stacking component.
Stacking = ModusProcess.GetComponent("Stacking")

; Create stacks for all envelopes with low priority.
; Repeatedly stack at most 1000 envelopes at the time, until all have been stacked.
Done = false
While (not Done)
                Stacking.SelectByOrganisationalMetadata("Priority", "Low")
                Stacking.SelectAtMost(1000)
																Stacking.SortByXPath("ccm:Recipient/ct:Zipcode")
                StackCount = Stacking.Run()
                Protocol("Stacking created " + StackCount + " low priority stack(s).", 5)
                If (StackCount = 0)
                                Done = true
                End-If
End-While

As the Stacking instance is shared over two calls, the second Stacking.Run call uses the metadata filtering that was set in the first call.

1 For all parameters with this remark, the collation is determined by the Batch & Output Management runtime database.