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 files or emails.
In these cases you should consider either this split function, the function Split spool (dynamic key position) or even Split spool (complex key).
In short the split is not generating new smaller spooled files, but instead a sub-tree in the workflow is executed for each section of the spooled file.
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 component has these parameters:
Key value position
This is the fixed positions and line(s), that is used as a reference to identify individual documents.
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.