Alteryx Designer Desktop Discussions

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

XML Parsing tool - sometimes field with XML exists and sometimes it doesn't...

katjaiseult
5 - Atom

Hi!

I have a workflow where I am reading in different XML files. They don't always look the same. They come from a reporting tool and I am checking for three different data containers in the report's XML. If the report has all three containers, my workflow runs perfectly! Otherwise, the XML doesn't include code from that data container and the XML Parse tool says "hey! that field is missing!" 

 

Is there any way to bypass this? Can I include a tool that says "if this column is missing then let's skip this section of the workflow, otherwise keep on going!"

 

In other words, when the report contains a Singleton, this works:

clipboard_image_0.png

But when my report does NOT contain a Singleton, this error pops up on the same tool:

clipboard_image_1.png

 

What do y'all think? I tried to add a filter and union the two back together so I get an output of Null values but the workflow can't move past this error, even when I say to ignore the XML.

 

How do I see if a column exists if it only sometimes exists?

3 REPLIES 3
adamorse
9 - Comet

You could put this in a macro, check if the field exists, and use a control parameter to turn the tool container on or off depending on whether or not that field exists. But that's not a super elegant solution, so maybe there's something in the XML tool that someone else can recommend....

Claje
14 - Magnetar

Why not use something like @MarqueeCrew 's CReW macro, Ensure fields, before this?  That would let you guarantee that Singleton exists and still flow the data downstream and process it appropriately.

katjaiseult
5 - Atom

This works perfectly, thank you!

Labels