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!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

XML parsing - unable to get all fields

Naga
8 - Asteroid

Hi All,

 

I need some help in extracting the xml file (mostly it is very huge file) with multiple child tags. I tried all options given in the https://help.alteryx.com/current/ReadingXML.htm, but unable to figure it out.

 

Input

<Employee>
<EmployerID>1234</EmployerID>
<FirstName>abcd</FirstName>
<MiddleName>xyz</MiddleName>
<LastName>MEZA</LastName>
<Suffix>MR</Suffix>
<Family>
<FamilyID>5678</FamilyID>
<FamilyFirstName>Maria</FamilyFirstName>
<FamilyMiddleName>xyz</FamilyMiddleName>
<FamilyLastName>Agnes</FamilyLastName>
<FamilySuffix>MR</FamilySuffix>
</Family>
</Employee>
<Employee>
<EmployerID>9234</EmployerID>
<FirstName>abcd</FirstName>
<MiddleName>xyz</MiddleName>
<LastName>MEZA</LastName>
<Suffix>MR</Suffix>
<Family>
<FamilyID>5978</FamilyID>
<FamilyFirstName>Maria</FamilyFirstName>
<FamilyMiddleName>xyz</FamilyMiddleName>
<FamilyLastName>Agnes</FamilyLastName>
<FamilySuffix>MR</FamilySuffix>
</Family>
</Employee>

 

Table

 

EmplyeeIDFirstNameMiddleNameLastNameSuffixFamilyIDFamilyFirstNameFamilyMiddleNameFamilyLastNameFamilySuffix
1234    5678    
9234    5978    
8 REPLIES 8
DavidP
17 - Castor
17 - Castor

I've used this macro before when I just wanted to pull all the child tags into a flat structure.

Naga
8 - Asteroid

Thanks @DavidP for the quick solution - Just want to check what configuration you used for the XML input file configuration

DavidP
17 - Castor
17 - Castor

Use an Input Data tool with file type CSV and delimeter set as \0

 

DavidP_0-1582109470492.png

The use autofield and then the parse XML macro

 

DavidP_2-1582109609977.png

 

Naga
8 - Asteroid

Hi @DavidP,

 

I tried and able to parse my data into it. But I need the output in table format, however, this doesn't meet that need and again in need to use those keys to spilit.

 

I have a data of 3 levels of Child tags, which I need to tag to the root, which is the employee.

 

Let me know if you have any other solution.

 

Thanks
Naga

DavidP
17 - Castor
17 - Castor

It will be much easier to help if you can post some sample data.

DavidP
17 - Castor
17 - Castor

Based on the data you pasted in your 1st post, does this work for you?

 

DavidP_0-1582126026094.png

 

Rehat
5 - Atom

could you please help me in parsing the attached file.

I have tried using the xml parse macro but not getting all the records in the output

 

DavidP
17 - Castor
17 - Castor

Hi @Rehat 

 

Attached is a packaged workflow that reads and flattens your xml file with the parse XML macro.

 

Let me know if this is what you're looking for.

 

If you're on an older version of Alteryx, you may get an error when double clicking the yxzp file. However, look in your downloads folder as it would have unzipped itself into a folder from where you should be able to run it.

Labels