Please enable JavaScript to view this site.

InterFormNG2 Manual

This section address the situations, where you have conditioned blocks of multiple lines in the input spooled file, that you want to map as blocks. A prerequisite is, that you have loaded a spooled file in the Library and then loaded the sample spooled file in the designer.

 

This is e.g. required in these situations:

 

The spooled file may contain variable data for multiple labels on a page where e.g. line 1 to 4 are the lines for label 1 and lines 5 to 8 are the lines for label 2 etc.

 

A block can also be a section of spooled files lines, that belong together as a detail line section, where the first line might contain part number, short description, price per unit, discount, quantity and line total and the second line may contain other formatted data like e.g. the dimensions and the weight of the object etc. and you want to freely move these elements around within an output block.

 

The description below only covers scenarios for which the block is a single line or a fixed number of lines. If you want to handle a block of a dynamic number of spooled file lines, then you can e.g. consider to use a variable to 'remember' that a block is currently processed and test the value of the variable early in the select element branches.

 

Let us consider a spooled file like this:

 

NG2MultiLineSplf001

 

We want to scan the spooled file for addresses and each time an address is found we want to insert a frame and map the address into this frame like below:

 

NG2MultiLineSplf003

 

For this these solutions can be considered:

 

Solution 1: Trigger on "Adr.:"

Solution 2: First non-blank line is triggered and reserves 6 spooled file lines

 

 

Solution 1: Trigger on "Adr.:"

One simple solution is to scan the spooled file for 'Adr.:' and insert a conditioned section where the 6 spooled file lines are mapped. This can be done with this template:

 

 

NG2MultiLineSplf002

 

Here is an explanation of each element:

 

The first repeat (//page) is for repeating through the pages of the input spooled file.

 

The first container (COND_MULTI) sets the start position for the line repeat. Any addresses found are placed below this.

 

The second repeat (subsequence(./line,1,42)) repeats through the spooled file lines 1 to 42.

 

The When branch of the select verifies if the current spooled file line contains 'Adr.:' in position 1 to 5. If so the following container is inserted in a dynamic position. The height of this container reflect the height of a single spooled file line in the output.

 

Inside the main container a container with a fixed position inserts the box and the two ng:spoolMapRel() functions maps first the address and then the "Adr.:" text in the input spooled file.

 

In the other wise branch another container is inserted with a dynamic position. The height of this container also match the height reserved for a single spooled file line.

 

 

Solution 2: First non-blank line is triggered and reserves 6 spooled file lines

In this scenario we ignore the fact, that for this spooled file there is a unique trigger, which identifies the start of a new address. Instead we could also search of a non-blank text and then handle 6 spooled file lines and ensure, that these 6 lines are skipped in the spooled file line repeat. Still we want the same output as in solution 1 above:

 

This can be done with this template:

 

NG2MultiLineSplf004

If you compare with the solution 1, then you see these differences:

 

1.A variable, block is introduced to keep track of which spooled file lines, that handled in the same conditioned block. The initial value is set to 0, so that a conditioned section can be triggered.

2.The condition for the elements, which here includes the frame and the two remaps is changed so here we verify the contents of 7 characters starting in position 8 of the current spooled file line  - and combine this with a condition for the block variable. If the block variable is 1 or higher, then the spooled file line has already been handled by a previous conditioned section. We use the ng:trim() function and compare with an empty string to ensure that this is only true if spooled file text is found, that is not blank (and it is not a totally empty line for which these positions would be an empty string.

3.If a conditioned section handles 6 lines like in this example the block variable is set to 6 when the conditioned section is processed.

4.In the bottom of the line repeat the value of the block variable is reduced with 1 to open up for another conditioned section to be called, when we have passed the processed spooled file lines.