Skip to main content

Create XML Output (Patterns and Rearranges) - Knowledgebase / Lasernet / Lasernet Training / Lasernet Form Editor 9 - XHTML, CSV, EDI, XML, JSON, PDF Form (filled) Output - Formpipe Support Portal

Create XML Output (Patterns and Rearranges)

Authors list

In this exercise, you are proposed to create a structure of the output in the XML format by adding patterns and rearranges, adding a regional profile and applying it to objects to change the regional settings for numbers and dates, as well as activating node values for which a rearrange is not presented.

Exercise

Download and import the attached configuration called 06. Create XML Output (Patterns and Rearranges) in Lasernet Developer 9. Afterwards, go to the Forms section and open the Sample form.

1. Start by adding rearranges to the input. To this end, in the input, add a rearrange to the InvoiceId node. On the Developer toolbar, click Rearrange.

2. When a pointer becomes a cross, click the InvoiceId node.

Once a rearrange is added to the input, you shall add it to the required node in the output. You have two options how to do this.

3. Right-click the rearrange in the input, and then click XML in the context menu that appears. As a result, the Edit XML Rearrange dialog opens on the XML tab.

4. Select the cbc:ID check box which denote a name of the node in the output to which you add the rearrange. Once you are done, click Ok.

5. As a result, the rearrange is add to the cbc:ID node in the output.

Otherwise, you can drag a rearrange from the input to the required node in the output.

6. Use the steps described above to add a rearrange to the InvoiceDate node in the input, and, afterwards, add the rearrange to the cbc:IssueDate node in the output.

7. The cbc:IssueDate node contains a date value for which you are to specify an appropriate format and a regional profile. You can do it later. Meantime, you are proposed to mark the node as incomplete. To this end, right-click the node, and then click Not complete in the context menu that appears.

8. Add two rearranges to the InvoicingName node in the input. When more than one rearrange are added to a node, its record becomes grey-highlighted.

9. First, drag the rearrange to the cbc:Name node available under the cac:AccountingSupplierParty node in the output. Afterwards, hold down SHIFT and click the InvoicingName node in the input once again, but now drag it to the cbc:Name node available under the cac:AccountingCustomerParty node in the output.

To switch between rearranges in the output, in the input, click the node to which both rearranges of the output belong, and then click the node holding down SHIFT. As a result, you can see a focus (a black rectangle) moves from one rearrange in the output to another.

Afterwards, follow steps 8-9 to add rearranges to the nodes both in input and output as it is shown on the picture below:

10. In the input, add a rearrange to the Salesbalance node, and then drag it to the cbc:PayableAmount node in the output. Afterwards, mark the cbc:PayableAmount node as Not complete.

You are now proposed to add a JobInfo to the input. To this end, follow the steps listed below.

11. On the Developer toolbar, click JobInfo.

12. When a pointer becomes a cross, click the CurrencyCode node.

Proceed to adding a JobInfo value to the CurrencyCode node attribute in the output. To this end, follow the steps listed below.

13. On the Developer toolbar, click Text.

14. When a pointer becomes a cross, click the CurrencyCode node attribute in the output. As a result, New Insert Text is added.

15. Double-click New Insert Text. As a result, the Edit XML Rearrange dialog box opens with the Objects tab.

16. From the Object type drop-down combo box, select JobInfo. Afterwards, type CurrencyCode in the text box below. Once you are done, click Ok.

To view the CurrencyCode node attribute value, press SHIFT+F5. Otherwise, on the View menu, click Run JavaScript.

Proceed to adding a pattern to the Body_CustInvoiceTrans node in the output. To this end, follow the steps listed below.

17. On the Developer toolbar, click Pattern.

18. When a pointer becomes a cross, click the Body_CustInvoiceTrans node in the input, and then click Ok in the Pattern Properties dialog that appears.

19. Add the pattern to the cac:InvoiceLine node in the output by dragging it from the input.

As a result, a multi-lined pattern is added to the output, and the cac:InvoiceLine node is shown as many times in the output as many lines belong to the pattern in the input.

20. Proceed to adding rearranges to the pattern in the input as it is shown on the picture below.

21. Once you are done, use any of available ways to add rearranges to the output:


InputOutput
Namecbc:Name
Qtycbc:InvoicedQuantity
salesUnitTxtcbc:InvoicedQuantity (the unitCode attribute)
SalesPricecbc:PriceAmount
LineAmountcbc:LineExtensionAmount


22. Mark nodes containing number values as incomplete by right-clicking each node, and then clicking Not complete in the context menu that appears.

Info: Status flags are a reminder tool only, to define the status of your work, and will have no effect on the final parsing.

23. Follow steps 13-16 to add a JobInfo value as a currencyID attribute to the cbc:PriceAmount and cbc:LineExtensionAmount nodes in the output.

As a result, a JobInfo is added as a currencyID attribute to the cbc:PriceAmount and cbc:LineExtensionAmount nodes.

You are now proposed to add a script to the cbc:ID node in the output. To this end, follow the steps listed below.

24. On the Developer toolbar, click Text.

25. When a pointer becomes a cross, click the cbc:ID node in the output. As a result, New Insert Text is added.

26. Double-click New Insert Text. As a result, the Edit XML Rearrange dialog box opens with the Objects tab.

27. From the Object type drop-down combo box, select Script.

28. To add a line counter, type Line + 1; in the text box to the right. Once you are done, click Ok.

To view the cbc:ID node value, press SHIFT+F5. Otherwise, on the View menu, click Run JavaScript.

It is time now to come back to the nodes containing date and number values and specify an appropriate format and a regional profile for them.

29. First, go to the cbc:IssueDate node in the output and double-click its value.

30. In the Edit XML Rearrange dialog box that appears, switch to the Formats tab.

31. From the Format category drop-down combo box, select Date.

32. On the Input format tab, select the Override form input format check box, and then click the Add button.

33. In the Edit Regional Profile Mapping dialog box that appears, select dd-MM-yyyy from the Regional profile drop-down combo box.

Once you are done, click Ok on both dialog boxes.

Proceed to the nodes containing number values and specify an appropriate format and a regional profile for them.

34. Go to the cbc:PayableAmount node in the output and double-click its value.

35. In the Edit XML Rearrange dialog box that appears, switch to the Formats tab.

36. From the Format category drop-down combo box, select Number.

37. On the Output format tab, select the Override sheet output format check box, and then click the Add button.

38. In the Edit Regional Profile Mapping dialog box that appears, select XML Format from the Regional profile drop-down combo box.

Once you are done, click Ok on both dialog boxes.

Perform steps 34-38 for those nodes which have number values and the CurrencyCode  attribute. For the cbc:InvoicedQuantity node, follow the same steps, but on step 37, additionally type 0 in the Number of decimals text box.

39. Once you are done specifying formats for the node values, you can remove the Not complete flag for those nodes. To this end, scroll up the output to the top, right-click the Invoice node, and then click Clear all flags.

On the following step, you are proposed to modify the rest of nodes for which no rearranges are added in such a way, so they can take their default values. To this end, follow the steps listed below.

40. Go to the xmlns:ccts attribute of the Invoice node and right-click its value.

41. In the context menu that appears, click Properties.

42. In the Node Template Properties dialog box, select the Use default value if no rearrange is provided check box. Once you are done, click the Ok button.

Here is the final view of your document after all proposed alterations.



Helpful Unhelpful

Add a comment

Please log in or register to submit a comment.

Need a password reminder?

Share