Alteryx Designer Desktop Discussions

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

Invalid Type in Operator ==

trangt
5 - Atom

I am getting "Invalid Type in Operator ==". My code that I am trying to run is below.

 

Switch([PARENT_HIERARCHY],'Other',
Contains('SB009',[PARENT_HIERARCHY]),'Medicare',
contains('SB120',[PARENT_HIERARCHY]),'Medicaid',
contains('HI085',[PARENT_HIERARCHY]),'Other Government Services',
contains('HI079',[PARENT_HIERARCHY]),'Other Government Services',
contains('HW009',[PARENT_HIERARCHY]),'Other Government Services',
contains('H1150',[PARENT_HIERARCHY]),'Commercial Business',
contains('CR600',[PARENT_HIERARCHY]),'Local Market Business',
contains('CC000',[PARENT_HIERARCHY]),'Marketing & Networking',
contains('HA060',[PARENT_HIERARCHY]),'Marketing & Networking',
contains('SO000',[PARENT_HIERARCHY]),'Service Ops',
contains('SE800',[PARENT_HIERARCHY]),'Strategy, Consumer Experience & Other',

contains('IN001',[PARENT_HIERARCHY]),'Strategy, Consumer Experience & Other',

contains('SZ000',[PARENT_HIERARCHY]),"Int'l Business",
contains('H1130',[PARENT_HIERARCHY]),'CHS',
contains('CC200',[PARENT_HIERARCHY]),'CHS',
contains('H9999',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',

contains('H1140',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',

contains('H1170',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',

contains('H1180',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',

contains('SS000',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',

contains('HW084',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',
contains('IT000',[PARENT_HIERARCHY]),'IT',
contains('BC001',[PARENT_HIERARCHY]),'Broker Commissions',
contains('TX001',[PARENT_HIERARCHY]),'Tax')

 

 

Thank you!

 

)

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

@trangt ,

 

 please consider using a FIND REPLACE tool to look for the text. You should have an easier time. 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
trangt
5 - Atom

Thank you for replying @MarqueeCrew.

 

I am using a formula tool to add a new data field based on [PARENT_HIERARCHY]. I apologized, I am new to Alteryx and am not quite sure how I can use find and replace to create a new field based on the content of [PARENT_HIERARCHY].

 

 

fmvizcaino
17 - Castor
17 - Castor

Hi @trangt ,

 

Take a look at the attached example. I'm showing exactly what @MarqueeCrew told you to do.

The idea is to use a find replace tool instead of that huge switch function.

fmvizcaino_0-1579838008158.png

 

Let me know if this works for you.

Best,

Fernando Vizcaino

trangt
5 - Atom

works perfectly, thank you!

Labels