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).
Please note: The spooled file is really not split up into new spooled files, but the sub-workflow is called for each new, splitted spooled file part.
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).
Please notice the section below: Split spooled files and save the status for later, if you want a main workflow to know if all processing of the splitted files went OK.
The advanced converter workflow has these parameters:
Search for
In the field "Search for" specify the text that you want to search for.
Search area
In the field "search area" specify the coordinates of the area of the page that you want to search within. For the best performance, you should try to select the smallest possible area.
Horizontal key position
In "Horizontal key position" specify the horizontal coordinate of the key value. Instead of using an exact position, you can use a relative position in relation to the top-left corner of where the searched value was found. To use relative coordinates, put + or - in front of the number. In the example above the value is set to -4, which means, that we want to split up on the values, that is found 4 positions to the left of the first position, that match our condition.
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.
Vertical key position
In "Vertical key position" specify the vertical coordinate of the key value. As with the horizontal value, you can specify it exact or relative to the searched value position.
In the example above we state +0 to indicate, that the value for the split is to be found on the same line, as where the search value is found.
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.
Key width
As "Key width" specify the horizontal width of the key value.
Action for pages without key
As "Action for pages without key" specify which action should be taken if the searched for value is not found on a page. You can either add that page to the same document as the previous page, or throw away that page.
Save key value as
The fields "Save key value as" and "Grouping rule (XPath for group name)" works the same way as in split spool (fixed position). You can specify an optional variable, that should get the split value extracted from the spooled file as defined above. Please notice, that the variable name is to be written without a dollar sign.
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.