Split spool (complex key)

Split spool (complex key)

A spooled file can be split into smaller files depending on the contents e.g. to split up a larger spooled file with many invoices into individual invoices.

 

If the other spooled file split functions are not enough, then you can consider this workflow component: Split spool (complex key).

 

This advanced, converted workflow component has these parameters:

 

NG2SplitSpoolComp001

 

Subset expression

This is a page selection criteria, that you can use in order to select specific pages of the input spooled file. This is matched with the key expression, so that the key(s) are extracted on pages, that match the condition for the subset. If you have loaded a sample spooled file (which is recommended) you can use the magnifying glass to select the spooled file data for the condition.

You can add multiple sets of conditions and keys with the add more icon.

 

Key expression

This is combined with the subset above in the way that if the condition in the subset expression is true, then the key value is found via this expression. In the example above we search for 'Invoice No' in line 13 and if it is found then the invoice number is extracted in line 13, but if the text 'Invoice No' is found in line 14, then the invoice number is extracted from line 14.

 

Action for pages without key

With this option you can decide what should happen with pages, where no subset expression is true. The possible values are:

Add to current document: With this value the pages are added to the previous key. In this way you can split up documents where the key (e.g. invoice number) is only found on the first page of each document.

Throw away: With this value all pages without a key are not included in the splitted output files. This can be considered, if you want to remove some pages, that are not really needed.

 

Save key value as

Here you can state a workflow variable, that should receive the value found in the spooled file as key value position. Notice, that you should write the variable without a dollar sign as above. After the split spool component you can e.g. create PDF files, that are using the variable as a part of the PDF file name or path.

 

Grouping rule

The field "Grouping rule (XPath for group name)" can be used to specify a rule for grouping pages. This can be used to group the split pages together in a smaller number of spooled files.

 

The rule is an XPath expression that must output the name of the group that the split pages should be placed in.

For instance, say you have three pages with key values 1001, 1002, 1003. If you do not specify a grouping rule, then this will result in 3 spooled files after the split.

If you saved your variable as "customerNo", then you can create a grouping rule like this:

 

if (number($customerNo) < 1003) then 'g1' else 'g2'

 

Now the output will be only two spooled files instead of three, one containing the pages with key value 1001 and 1002, another containing the page with key value 1003.

The name of the spooled file's group can be found as the workflow variable, "interform.spooled.groupName".

 

 

Example of use: You can find an example of how you can implement a split definition with variables in the section, Example: Use variables for naming output files.

    • Related Articles

    • Split spool (fixed key position)

      If you want InterFormNG2 to process spooled files, that contains multiple documents e.g. multiple invoices within a single spooled file (e.g. generated by a batch invoice run), then you may want to split up the spooled file into multiple output PDF ...
    • Split spool (dynamic key position)

      As the split spooled file (fixed key position) component above, this component can be used to split a spooled file based on a key value. However, in this case the key value can be in variable positions on the page. You just need to be able to find ...
    • Spooled file split

      You might want to split up spooled files during InterFormNG2 processing. The reason might be, that the input spooled file may contain multiple documents (e.g. invoices), and that you want to create one PDF file (or email) for each invoice. There are ...
    • Split XML

      This advanced converter workflow component can split up an XML in the payload of the current workflow. The subtree of this workflow component is executed for each splitted XML. A similar component, which is also able to transform the splitted files, ...
    • Delayed email cancel key

      The Delayed email cancel key component is used together with these workflow components: 1.Cancel delayed email. Use this component to cancel a delayed email. 2.PDF Delayed email. This defines a delayed email. 3.Send emails from delay queue. This ...