community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcement | Get certified today - take the Alteryx Designer Core and Advanced exams on-demand now!
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Weekly Challenge
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Unable to display your progress at this time. Please try again a little later, or contact an administrator if you continue to see this error.

Challenge #37: Parsing a Raw XML File

Alteryx Alumni (Retired)

The link to the solution for last challenge #36 is HERE

 

Using raw XML files as input can present some interesting challenges.  The challenge is that the data is nested into the records in a way that requires you to extract it through parsing steps, sometimes drilling many levels into the data (Root and child levels).  Alteryx makes this easier to do using the XML Parsing tool.  We will explore the process in this exercise.

 

Use Case: A company receives customer purchase and shipping data on a weekly level based on web and catalog purchases.  The company would like to analyze their customers and produce a profile by market by SKU.   The challenge is that the data feed contains XML that needs to be parsed in order effectively analyze the data.

 

Objective:  The column called customer_OuterXML contains the data that needs to be parsed into 26 unique fields detailing the customer contact information for both the “Bill To” and “Ship To” attributes.

Alteryx Certified Partner
Spoiler
One solution.jpg

New to xml parsing. There's probably a simpler way to do it. Curious to see what everyone else comes up with. 

Asteroid

This is what I did but would also be interested if it can be done in fewer steps.

 

Spoiler
Capture.JPG
Bolide

I have seen this exercise before!

Bolide

Ok found it.

Nice clean solution Mark. You can do it with 5 xml parse tools in one stream :)

Asteroid

Yes, it looked familiar to me also.  Seems like there was a training video or class.

Creative Director
Creative Director

A solution has been posted

Spoiler
2016-08-22 08_47_13-Alteryx Designer x64 BETA - DataPrep_Parsing XML_Intermediate_Solution.yxmd.png

 

Tara McCoy
Aurora
Aurora

My solution was similar to @Naledi

Spoiler
- although the posted solution ( @TaraM / @GeneR ) - I worry that by using hard renames like this it would make the process brittle in the face of change.
- what I did (and it looks like @Naledi did too) is to progressively parse down the tree, and at each stage use a dynamic rename on the dynamically added columns
- This means that even if columns are added to the XML (which happens quite frequently in prod environments) - this solution would gracefully include these fields

Also - by breaking this into smaller subsets of data - you can join it back very easily using a record ID - so each transformation becomes easier to deal with (smaller data sets) the lower down the tree you go.

Thank you for the exercise

Sean

 

Quasar

Trying to to as little hard renaming as possible makes this a long workflow, and a great exploration of the XML parse tool.

Spoiler
SPOILERimage.png

My solution!

 

Turns out not all parsing tools are created equal, and I do NOT like XML parse as much as RegEx. But I managed... Very similar to other solutions, although kudos to @SeanAdams on the point about the dynamic rename, that is definitely a better long term/adaptable solution.

 

Spoiler
WeeklyChallenge37.JPG