Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

testing if field exists in input file

MassimoDM
7 - Meteor

Hello, 

 

as I am creating an Analytic app that is going to be used by other people, I'd like to add a test that checks if the fields contained in the input file are named in the right way (the way Alteryx workflow expects). 

 

the test would be something like: "blablabla" is not an existing field_name in input file (an Excel file)

 

I tried to do so both with the "error message" tool and the "test" tool but it seems they don't allow me to access fields names.

 

Any suggestions on how to do so in the simplest way? Like avoiding to transpose all columns to rows and check all rows with Contains(row,"blablabla")

 

thanks in advance

4 REPLIES 4
danilang
19 - Altair
19 - Altair

Hi @MassimoDM 

 

Use the Field Info tool from the Developer palette.  It outputs info on the fields as rows 

 

fi.png

 

Dan

 

 

MassimoDM
7 - Meteor

thank you @danilang however I'm still fighting agaist it: I would like to output a specific error message to the final user in case the column doesn't exist. 

 

I basically need an Error Message tool that can be attached to a normal input.

danilang
19 - Altair
19 - Altair

Hi @MassimoDM 

 

Here are the changes to make to your workflow

 

w.png

 

Block Until Done ensures that the top branch runs to the end before the rest of workflow continues.  After the Field Info, filter the fields you're looking for.  Count the records from that match your criteria.  Configure the message tool to error when the count is not correct.  

 

m.png

 

Put this branch as early as you can in the workflow

 

You also need to configure the workflow to Stop on Error

 

c.png

 

Dan

 

 

MassimoDM
7 - Meteor

Great! thanks again @danilang 

Labels