Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
dmagnus
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.

 

gallery.alteryx.com.pngEditor's note... Here is a similar tool created by Rahul Sachdeva of Grazitti Interactive: XML Output

Description: "Outputs tabular data into XML Format. Use with Workflow or File Mode."

[This was mentioned in the comments below and preserved from the now deprecated gallery.alteryx.com site.]

Comments
TimothyL
Alteryx Alumni (Retired)

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

 

TL

princejindal
9 - Comet

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!

NeilR
Alteryx Alumni (Retired)

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

 

VijayGopal
5 - Atom

Hi All,

 

can someone attach the Creating XML from tabular data app. not able to download from the given link.

 

Thanks,

NeilR
Alteryx Alumni (Retired)

@VijayGopal I've attached the files to the post.