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 its location by searching for some other fixed value on the page. For instance, if your pages contains an invoice number as key, and it is always written as "invoice: XXXX", then you can search for the text "Invoice:" and then pick out the key value in a position relative to where the text 'Invoice" is found.
An even more advanced spool split function is split spool (complex key).
Any changes to variables within the split definitions are local for the actual split and are forgotten when the next split is processed (and when all processing of the splitted files are done).
The advanced converter workflow has these parameters:
0 is an invalid value, which will cause the error: Array index out of range: -1 in the job log, as the positions are measured from 1 and up. If you want to state, that the positions used for the split should be the same as the condition, then you should specify +0 to indicate a relative position - and NOT a fixed position of 0.
Like for the horizontal position you should NOT state the value to be 0, as this will cause the error: Array index out of range: -1 in the job log, as the positions are measured from 1 and up. If you want to state, that the positions used for the split should be the same as the condition, then you should specify +0 to indicate a relative position - and NOT a fixed position of 0.
The example above is setup for a spooled file, that looks like this:
The definition search for the text /PMK in the positions 61-64 in the lines 8 to 16. The invoice number is found in the same line as /PMK (if found) - 4 positions to the left.
If there is a page in the spooled file without the text /PMK, then this page will be included in the last page, that was previously selected by the search.
The variable, InvoiceNo can be used e.g. in the following Create PDF file component to build up a dynamic PDF file name.
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.