We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

TCD tool Dynamic | XML

AliciaBon_92
5 - Atom

Hi everyone,

 

I have a workflow that uses data where the column names can vary from one run to another.

In my process, I use a Cross Tab tool that I’ve made fully dynamic using two macros:

  • The main macro takes as input the grouping columns, the header column, the value column, and the aggregation method. It dynamically generates the XML formula for the Cross Tab tool.
  • This formula is then passed to a secondary macro, which uses a Control Parameter + Action tool to inject the formula into the Cross Tab tool.

Everything works fine, and the workflow runs successfully, but I get a false error message in Alteryx:

 

ActionToolId:6 contains an error: XML parse error: message=expected >, Location=<Field fied="Fichie<Field fi..."

 

This message only appears when column names contain an underscore, such as Fichier_Prix.
If I exclude all columns with underscores, the error message disappears.

I tried to protect the field name using XML entities like:

 

'<Field field=&quot;'+name+'&quot; />'

 

 

But it doesn’t work — Alteryx doesn’t seem to recognize &quot; as a valid quote character in this context.

 

So I ended up writing it like this instead:

 
'<Field field="' + name + '" />'
 

 

🔍 Question:
Does anyone know how to safely handle column names containing underscores in the XML formula, or how to prevent this false error message while keeping the workflow dynamic and functional?

Thanks in advance for your help!

2 REPLIES 2
apathetichell
20 - Arcturus

hey --- I see alot of messages on this forum re: dynamic tools --- and a lot of attempts at solutions using editing the xml --- this is almost always not the best solution. Almost always ---> some kind of batch macro (nested) --- using dynamic select is MUCH easier and will not get you in trouble with xml special characters.

KGT
13 - Pulsar

This is a good case for the debug function. In Interface Designer, you can go to Test and then fill out your interface tools and Open Debug to open a workflow with all your options configured in tools. You will then be able to se what the Action tool has injected.  I highly recommend checking that out if you can't get the formatting to translate.

 

This is the format on my version (2023.1) for a random one that I had open which has a bit in it, but I imagine it would still be the same on any others:

<FormulaField expression="IF [Net_Hours]&gt;5&#xA;AND [Unpaid_Break]&lt;0.5&#xA;THEN &quot;Employee worked more message&quot;&#xA;ELSE null()&#xA;ENDIF" field="Meal.Break2 Flag" size="1073741823" type="V_WString" />

 

This does not look correct though. Field Fied, and the second < don't look standard, but may be the error you are referring to.


ActionToolId:6 contains an error: XML parse error: message=expected >, Location=<Field fied="Fichie<Field fi..."

 

The only characters that need to be escaped are:

"   &quot;
'   &apos;
<   &lt;
>   &gt;
&   &amp;

 

Labels
Top Solution Authors