This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
I have created an iterative macro for parsing an XML field in a table into a flattened format but I'm having a bit of trouble finishing it off.
The issue arises as not every record has all of the fields, so when I try to use a select tool within the macro, if the field doesn't exist in that specific record, I get a "no valid field was selected" error and the macro fails. Does anybody have any idea on how to fix this?
To parse this I used xml parse on the field looking for the child element <airline> and returning the outer xml. I then used the select tool to filter to just the outer xml field and another xml parse tool to get the child elements id = foo, name = bar. I can't just use a single xml parse tool specifying "specific child name" = "id" as there are multiple id fields in the document.
My issue comes when I try to parse an iteration where there are no elements called <airline>, the select tool doesn't find airline_outer_xml as a field and erros, failing the macro.
Any help would be much appreciated!
(The area where my workflow breaks down. The top tools are when it's working i.e. <airline> exists in the document, the bottom is where it fails i.e. when <airline> does not exist)
It would be best if you could send the file in which you are implementing the macro. If you send the zipped file (exported the way I describe above) it should include the macro itself and any template data.
And I totally understand about not wanting to share sensitive data-- any sample data would help, as long as I can recreate the problem.