Description:
This step converts the XML data to XLS file format.
Inputs
- xmlVariable – variable/global that holds the XML data
- xlsFilePath – variable / global that holds the output file path on the server
- xmlNodeName – mention XML node to parse or consider the XML data between <root> and <\root> tags to parse by default
- workSheetName - renames the worksheet with this name (not mandatory)
- writeColHeadings - write column names (On / Off)
Returns
- True – step executed successfully
- False – step failed to execute
Usage:
Example:
Let’s build and execute the “XmlToXlsDef” example.
- Create a new definition called “XmlToXlsDef”
- Select the definition and click the “design” button
- Drag a “XmlToXls” step from the toolbox
- Connect the dots between the start and “XmlToXls” step
- Configure variable.FilePath as string
- Click the “readFile” step to configure its “Settings” properties. Provide a name to the step. Provide the variable/global which holds the XML data. Provide the file path info to store the XLS file.
- Click the “readFile” step to configure its “Advanced” properties. Provide the XML node info for the XML data. Provide the worksheet name. Select “On” to include column names for the worksheet.
- The “Logging” setting configuration is necessary for documentation and also measures the workflow progress and the percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.
- Generate a new process instance. Initialize the varXML variable with the sample XML data shown below. The step shall process the raw XML data between the <root> <\root> elements or a specific node configured above in Advanced - XML nodes to be processed. This XML node can also refer to the root node (root) or specific node (node) in the XML data. Copy and paste the sample XML data into the xmlVar variable to initialize. Typically, the varXML variable is initialized by other XML steps like (executesql and generatexml) in a process workflow. Execute this new process instance.
<root> <node> <to>mike@email.com</to> <from>flowwright@support.com</from> <heading>New social handle</heading> <body>Hi! We're here on Instagram now. Let's connect!</body> </node> <book id='bk101'> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> <node> <to>lowry@email.com</to> <from>flowwright@support.com</from> <heading>New social handle</heading> <body>Hi! We're here on Instagram now. Let's connect!</body> </node> </root>
- Execute the new process instance.
- The step shall transform the XML data to an XLS file on the server. The default Sheet1 worksheet is renamed with the value (TestSample) as configured above. Download the XLS file and use the appURI and filePath variable values from the step property.