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.
SOLVED

How to work with Fields that might not exist and avoiding Parse Errors

AlexApolloni
7 - Meteor

I want to do two things (with some caveats)

  • Check if a field, which might or might not exist, IsNull with the Message tool.
  • Avoid getting an error warning that the field doesn't exist when adding the above to a Macro.

My use case is that I'm running a Rest API call using the Download tool. It returns some XML which I pass to the XML Parse tool.

If the call is successful, then the Parse Tool outputs a "createdAt" field.  If not, it doesn't.

 

In the Message tool I have "IsNull([createdAt])"for the test.

 

I'm in a catch-22. When I add this to a macro and include it in a workflow, I get a Parse Error/Warning that the field [createdAt] doesn't exist.  (the workflow runs fine..but the error is confusing if I want to share the macro with coworkers)

If I use the formula tool to create the field with a null then the warning goes away....

but...the XML Parse tool checks for before create the field so it creates it as [createdAt2] which is no good.

DynamicRename won't let me remove the 2 because [createdAt] already exists.

 

What is the best practice for this?   It seems like a common use case, no?

 

AlexApolloni_4-1668678029185.png

 

AlexApolloni_3-1668677857978.png

 

Many Thanks,

Alex

3 REPLIES 3
FilipR
11 - Bolide

Personally, I would put a Filter tool after your Download or XML Parse and do a check if the call was successful in it. You will avoid errors then and will be able to configure your Message tool easily.

 

If after the Filter or XML Parse tool you have missing field errors, just add a field in a Text Input (just put field names, with no rows) and introduce it via Union.

AlexApolloni
7 - Meteor

OK, that's helpful/practical advice.  Thanks!

I can do a filter after the Download tool using the DownloadData field it creates....

(but I can't after the XML Parse because the filter would be on a field that might not exist.....)

FilipR
11 - Bolide

@AlexApolloni did this tip solve all of the issues? If so, please mark my answer as the solution.

Labels