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.

Unknown Variable in an Expression because Crosstab creates new fields at runtime

RquanEvernorth
6 - Meteoroid

I have field called AOP and it's values can be Absent or Present.

 

I use a Crosstab to create two new columns, Absent and Present by setting "Change Column Headers" = AOP.

Then downstream, I have a Formula Tool that is using those Two New Columns, Absent and Present. 

 

This works fine when I execute it in the Designer and when there is data present to create the two new fields.

In essence, the new fields are created at runtime by the Crosstab.

 

Two issues arise.

1. If there is no values of Absent or Present in AOP, the Formula Tool fails.  In fact the Formula Tool doesn't provide the field names until this has been execute at least once to create the fields.

2. This fails upon validation when deploying to the Gallery with "Parse Error at char(xxx): Unknown variable "Present" (Expression #1)

 

I can deploy by omitting the validation step but would prefer to "trap" for the parsing error, or stub in some dummy values in some way.

Thoughts and Thanks.

RQ

 

PS. I cannot upload images or files through our firewall, else I would.

 

1 REPLY 1
alexm06
8 - Asteroid

Hi @RquanEvernorth ,

 

You could try using the Input Data tool to insert a dummy line of data that contains the two required fields (Absent and Present) to allow the Formula tool to run. Then just use a Filter tool after the Formula tool to remove the dummy line.

I've attached an example.

Please let me know if that solves your problem!

Labels