Skip to main content

Patterns and Conditional Area - Knowledgebase / Lasernet / Lasernet Training / Lasernet Form Editor 9 - Designing Forms - Formpipe Support Portal

Patterns and Conditional Area

Authors list


In Lasernet, patterns are used to recognize specific line items in the input. Rearranges, barcodes, images, text, shapes, etc. added to a pattern are automatically included to the Conditional Area of the form.

When you add rearranges to a pattern, by default, it is listed in <Default Conditional Area> in the FIFO order. The Default Conditional Area has customized settings for the Start Y and End Y positions on each output page (first, middle, last and single). Rearranges of the first Pattern are written within the baseline for Start Y, and a new page is created when End Y is reached.

Conditional Area

A Default Conditional Area is added by default, but the values of the Start and End Y positions varies depending on the height of the paper size. The positions for Start Y and End Y of the Conditional Area for the First, Middle, Last and Single Pages are maintained in the Edit Conditional Area dialog. To open it, on the menu bar, click Sheet, and then click Conditional Area.

Pattern

A pattern criterion is use to recognized XPath in the input. To define a pattern, on the Developer toolbar, select the Pattern tool [1] to highlight the elements [2] to be included to the pattern. On the left side of the workspace, you can see a green marker defining the element(s) which match the pattern.

Double-click a pattern, or select a pattern, right-click it, and then click Properties to edit the pattern object properties.

You can use the output pattern properties to maintain the output design for patterns added to the Conditional Area.

You will use the alternating pattern properties only when a table is added to the output. For a table, you can specify a color of odd/even rows (defined by instance(s) of a pattern), as well as define the other settings.

Exercise

Download and import the attached configuration called 15. Patterns and Conditional Area in Lasernet Developer 9. Afterwards, go to the Forms section and open the Sample form.

1. Right-click in the design view and select Conditional Area in the context menu to define the Start Y and End Y positions for the Conditional Area in the design view.

2. Select the <Default Conditional Area> in the list of Areas, and then click the Edit button to edit the properties of the Conditional Area.

3. Set Start Y to 110 mm (Single Page).

4. Set End Y to 270 mm (Single Page).

5. Click the Ok button on the Edit Conditional Area dialog box to accept settings for the <Default Conditional Area>.

6. Click the Ok button on the Conditional Area dialog box to accept settings for the list of Conditional Areas (currently only one).

You have now defined where to show the first and last item lines for a Single Page. Your next step is to define patterns for the item lines and assign them to the Conditional Area.

7. On the Developer toolbar, click the Pattern tool.

8. In the input view, click the /Root/Body/Item node.

With the dialog displayed, specify Body/Item for Start pattern criterion and exists for Operator. Pattern Name is only a description, so you can type any text here. Once you are done, click Ok to accept changes.

9. On the Developer toolbar, click the Rearrange tool.

10. In the input view, click the /Root/Body/Item/Article node. The rearrange is automatically assigned to the pattern.

11. On the Property bar, set X position to 15 mm.

12. Create four additional rearranges for the following tags: Description, Quantity, Price and Amount. Set Position, Font name, Font size and Alignment of the rearranges as illustrated on the picture below.

The progress between pattern instances is determined by the Progress value of the pattern output settings. In this example, it is defined that the progress (line spacing) between the item lines is 5 mm.

13. Add a pattern to the /Root/Body/Info node.

14. Add a rearrange to the pattern by selecting the /Root/Body/Info/Text element. Edit position properties of the rearrange by setting Size type to Auto Y. This can help you to control the width of the text string in the Description column.

15. Set the X position to 42 mm.

16. Set Width to 60 mm.

17. Once you are done, click Ok.

The width of the rearrange will now fit the column size due to word wrapping, where the second line overlaps the next item line.

To fit the line height, follow the steps listed below.

18. Either double-click the /Root/Body/Info pattern, or right-click it and select Properties on the context menu. In the Pattern Properties dialog, switch to the Output tab and set Progress to 0 mm.

19. Select the Progress is relative to highest rearrange check box.

20. Once you are done, click Ok.

The item lines do not overlap anymore as we have added additional line spacing to the Conditional Area. The progress is now relative to the height of the rearrange object for the Info/Text node and is calculated by the system.

Note: To manually control the Line Height of a rearrange, open the Position settings of a rearrange. Set Size type to Auto Y [3], Line height to Absolute and 5 mm [4], select the Use empty line height check box and set the value to 5 mm [5].

It is time to add information for the discounts, which is present in the /Root/Body/Item/Percent element. Only a few item lines includes discounts. We will highlight those items with bold and present them in the (5%) format. Since we have only the value present in the XML data, we are to add a fixed text to the rearrange and enclose it in ( %).

21. Add a new pattern of the /Root/Body/Item node in the input view. To this end, open the Pattern Properties dialog and set Pattern Name to Percent > 0 (this is a description).

22. Change the XPath in the Start pattern criterion to Body/Item[Percent>”0”].

23. Select the Allow further pattern matching check box. This can allow next patterns in the list to match exactly the same node.

24. Switch to the Output tab.

25. On the Output tab, set Progress to 0 mm.

26. Once you are done, click Ok.

If the Allow further pattern matching check box (see 23) is cleared (default value), only the first appearance in the list of the pattern is processed. If the Allow further pattern matching check box is selected, the next appearance matching a pattern is also processed.

27. Add a rearrange to the pattern. Since there is more than one pattern matching the node, on the Developer toolbar, click the Rearrange tool and holding down the Shift key click a rearrange in  the pattern containing a percent element. A context menu is displayed showing all patterns matching the selected line. Select the pattern that contains Percent > 5 and create a new rearrange.

28. Edit the rearrange by switching to the Objects tab and clicking the Add button to add a fixed text.

29. Insert ( in the Fixed text field.

30. Move up the Fixed text by clicking the Move up button to show it as the first string in the Objects list.

31. Add two additional objects: one with the % character, another one with ). Reorder them as illustrated in the picture below.

32. Once you are done, click Ok.

33. Select the rearrange including the discount object. On the property bar, set the X position to 133 mm.

34. Set Font to Bold or press the CTRL+B keyboard shortcut.

The last item line contains the additional cost, freight.

You can highlight it somehow, for example, by setting the font property to bold for all the rearranges. To this end, follow the next steps.

35. On the Menu bar, click Sheet, and then click Pattern And Rearranges. As a result, the Patterns and Rearranges dialog opens.

36. On the list, select a pattern named Item.

37. Click the Duplicate button.

38. Click the Edit button to change the settings for a new pattern (the first item in the list).

39. With the dialog displayed, select the Allow further pattern matching check box.

40. On the Instance(s) qualifiers group box, first, clear the All check box, and then select the Last and Single check boxes.

41. Once you are done, click Ok.

42. On the list, select the Item pattern (the last item in the list) and then click the Edit button. In Pattern Properties ->Instance(s) qualifiers settings, first you must clear the All check box, and then select the First and Middle check boxes.

43. Click the Ok button on the Pattern Properties dialog.

44. Click the Ok button on the Pattern And Rearranges dialog.

45. Select all rearranges added to the last item line.

46. On the Property bar, set Font to Bold.

Let’s add a sum to the amount column to complete the form.

47. Add a rearrange to the /Root/Footer/Amount node in the input view.

48. Set the X position to 195 mm.

49. Set the Y position to 281 mm.

50. Set Font size to 18 and select Bold.

51. Set Box horizontal alignment to Right.

52. On the Developer toolbar, select the Text tool and insert a fixed text with the Total text before the amount. Set Font size to 18 and select Bold.


Helpful Unhelpful

1 of 1 people found this page helpful

Add a comment

Please log in or register to submit a comment.

Need a password reminder?

Share