Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Nested if statement no longer working on 2022.1 version

rslotemaker
5 - Atom

I have a nested if statement which has been working fine for months in the 2021.4 version of the Designer. On my new laptop I installed 2022.1 and this version is showing an error.

 

The formula I have is:

 

if contains([Candidate Name],"(internal)",1) then "Internal"
else if contains([Candidate Name],"(prior worker)",1) then "Prior worker"
else if contains([Candidate Name],"(referral)",1) then "Referral"
else ""
endif
endif
endif

 

The error message is:

 

Error: Formula (137): Parse Error at char(144): Formula: tried to apply string operator to numeric value (Contains) (Expression #1)

3 REPLIES 3
IraWatt
17 - Castor
17 - Castor

Hey @rslotemaker,

The data type of your Candidate Name column must be numeric not text. Put on a select tool before the formula tool and change the type of Candidate Name to VString.

IraWatt_0-1668417692298.png

 

I have attached an example.

IraWatt
17 - Castor
17 - Castor

You can find some good quick videos on how data types work here on the community https://community.alteryx.com/t5/Interactive-Lessons/Understanding-Data-Types/ta-p/73958

rslotemaker
5 - Atom

@IraWatt thanks for your help. Since it worked fine in the older version of Designer, I hadn't realized the data type from the input was set to Double instead of string. I've changed that and now it works fine!

Labels
Top Solution Authors