community
cancel
Showing results for 
Search instead for 
Did you mean: 

Engine Works Blog

Under the hood of Alteryx: tips, tricks and how-tos.
Alteryx Alumni (Retired)

I find myself occasionally using alteryx to generate XML from tabular data. In the past I have always created solutions specific to the data at hand. I have decided that it is time for me to create a generic tabular to XML alteryx wizard.

 

Tabular Data:

 

XML:

 

Tabular_to_XML.yxwz

 

I tried to make this as flexible as possible, so there are a few complexities and options to discuss:

 

Here's how it works:

 

Each level of XML is created from one or more columns of tabular data.

If you wish to have multiple attributes for a level, you will need to group columns by name. The columns "Category", "Category:ID", "Category:isValid" will produce an xml level where each node will have "value", "ID" and "isValid" attributes. Notice that if you don't specify an attribute name ("Category" vs" Category:value"), then "value" is used by default.

 

The first attribute for each level will be used to determine the structure of the XML. That is to say that the first attributes for the children of any given node must be unique.

 

The interface:

 

I/O files: The user is asked to point to both a tabular data source and an output file (.xml).

 

Top level node type: The user must specify a node type for the top level of XML.

 

Node types: The user can choose to use the column names from the data source as the node types or specify a generic type to be use throughout the file.

 

Don't remove blank nodes: If left unchecked, nodes with blank "first attributes" will be removed and children will be moved up the branch while maintaining their type.

 

The files in this example are included here.

Comments
Alteryx
Alteryx

Great work. Just to add, here is another XML output macro in Alteryx Gallery: https://gallery.alteryx.com/#!app/XML-Output/565bfd4caa690a12542665e3

 

TL

Asteroid

Hi @dmagnus,

 

Hope you are well! I found your app really good, however, I am not able to open the workflow behind it. Is there any way I can do it? Because when I right click your alteryx app icon, I don't get the edit option. I am wondering this could be, perhaps, because it was created on an older version. I would like to see the workflow behind the app, and would appreciate the help!

 

Thanks!

Sr. Community Content Manager
Sr. Community Content Manager

@princejindal I'm not having any issue opening the app. Maybe try going through Designer... File > Open Workflow instead of right clicking?

 

Labels