Hi All,
I'm trying to parse an xml with optional field so I've build my flow alteryx extensively to take all the field into consideration but when I have an xml with not all the field the flow fail because it cannot find the field.
IE I have the following xml :
<field1>
<filed2> (optional)
So my flow is Parsing the xml to have the 2 field -> Condition !isnull[field2] -> ....
So for a xml with both field it's working, but for an xml with only field1 I get an error on the condition and my flow is failing.
Do you have any idea on how I can create a flow which is working for both xml?
Thanks
Cyprien
Solved! Go to Solution.
Hi @Cyprien,
There is ways using Macros and detours etc, however the easiest way around this is to transpose the data so that both fields appear in the one field. You can then just parse that field and crosstab back if needed.
Kane
Hi @KaneG,
Thanks for your answer, but I don't think the transposition will fit my problem as I can have thousands of records being treated in my flow. I think it will be easier for me to use Macro as I will have to do it for several flow, with very complex XML.
Do you have any example on how to do it with macros and detour?
Thanks
Cyprien
Check out the "Ensure Fields" macro in the CReW macro pack
http://www.chaosreignswithin.com/p/macros.html
Just add it after your XML parse tool and put in the field names that you need the data stream to always have.
Hi @AdamR,
Thanks a lot this is exactly what I was looking for :)
Cyprien