This article will outline how to create a Dataset in Lasernet from XML data. Creating this Dataset will allow further functions to be executed, and make the creation of Word and Excel output easier given that both will not accept direct XML input and necessitate the creation of separate input Datasets instead.
Data such as XML will need to go through a Dataset form to create a Dataset output which moves into a Richtext (Word/Excel) output form. This can be achieved with separate form engines or by looping the data back and using form criteria to ensure it reaches the right form.
The diagram below shows how Input data goes through one form to become Dataset data and then goes into a Rich Text output form to become an Excel, Word or XHTML output. This article will focus on the first Form and the creation of the dataset data.
You will need to open the Lasernet Developer and follow the below steps:
1. Create a new Form and select Dataset under the Output Format drop-down. Under the Input Format drop-down, the format should remain XML. Click OK to finish.
3. Before an output structure can be created, the Pattern tool must be applied to the main elements.
In the example, Pattern is applied to Item and Detail nodes.
4. After pattern has been mapped, rearranges must be assigned. Select the Rearrange tool and choose the required elements to rearrange.
7. Select and drag the input pattern elements to the output table. Press down the CTRL key and drag the Item node to the Template tab of the output.
Two options are provided when mapping the data from the XML sheet to the Template tab These can be seen in the following image:
8. Choose the option Add pattern as a nested table, this will select the pattern name and create this as a table.
A) All rearrange in this pattern will be nested in the Pattern table. The image below gives an example of this nesting, where Item is the pattern and the rearranges are nested under each table:
We need to ensure a Master table is created to ensure ease of use when using this dataset output in a Word\Excel form. For example a Master table exists below to encapsulate several tables.
Once this has been completed, you can set a destination for a Dataset Input Form. The Dataset can be saved to produce a functional Dataset as a grab file in Dataset Input forms.
To save, open the XML tab (bottom-left of the second page), open the File, select Preview, and then click Save.