Alteryx Designer Desktop Discussions

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

Malformed if Statement

jobytrice
5 - Atom

Why won't this work? 

 

IF [F1]="Network: GLITZ TV ARGEN" OR IF [F1]="Network: GLITZ TV Panregional" OR IF [F1]="Network: SPACE ARGEN" OR IF [F1]="Network: SPACE MEXICO" OR IF [F1]="Network: TNT Argentina" OR IF [F1]="Network: TNT Chile" OR IF [F1]="Network: TNT Mexico" OR IF [F1]="Network: TNT Series" OR IF [F1]="Network: Boomerang Latin America" OR IF [F1]="Network: Cartoon Network Argentina" OR IF [F1]="Network: Cartoon Network Mexico" OR IF [F1]="Network: TBS VERY FUNNY ARGENTINA" OR IF [F1]="Network: TBS VERY FUNNY BRAZIL" OR IF [F1]="Network: TBS VERY FUNNY PANREGIONAL H" OR IF [F1]="Network: TURNER CLASSIC MOVIES" OR IF [F1]="Network: TURNER CLASSIC MOVIES ARGEN" OR IF [F1]="Network: Warner Channel Andes" OR IF [F1]="Network: Warner Channel Mexico"

THEN "YES"

ELSE ""

ENDIF

6 REPLIES 6
MarqueeCrew
20 - Arcturus
20 - Arcturus

@jobytrice,

 

That's not quite the right syntax.  Here is a revised IF statement:

 

IF
[F1] in ("Network: GLITZ TV ARGEN", "Network: GLITZ TV Panregional", "Network: SPACE ARGEN", "Network: SPACE MEXICO", "Network: TNT Argentina", "Network: TNT Chile", "Network: TNT Mexico", "Network: TNT Series", "Network: Boomerang Latin America", "Network: Cartoon Network Argentina", "Network: Cartoon Network Mexico", "Network: TBS VERY FUNNY ARGENTINA", "Network: TBS VERY FUNNY BRAZIL", "Network: TBS VERY FUNNY PANREGIONAL H", "Network: TURNER CLASSIC MOVIES", "Network: TURNER CLASSIC MOVIES ARGEN", "Network: Warner Channel Andes" , "Network: Warner Channel Mexico")
THEN "YES"
ELSE ""
ENDIF

There are many ways to skin this cat!

 

Cheers,

Mark

 

P.S.  Please consider a vote for our Analytic Excellence Entry:  https://community.alteryx.com/t5/Alteryx-Analytics-Excellence/Excellence-Awards-2017-Adam-Rant-From-...

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Joe_Mako
12 - Quasar

How about:

 

IF [F1] IN(
"Network: GLITZ TV ARGEN",
"Network: GLITZ TV Panregional",
"Network: SPACE ARGEN",
"Network: SPACE MEXICO",
"Network: TNT Argentina",
"Network: TNT Chile",
"Network: TNT Mexico",
"Network: TNT Series",
"Network: Boomerang Latin America",
"Network: Cartoon Network Argentina",
"Network: Cartoon Network Mexico",
"Network: TBS VERY FUNNY ARGENTINA",
"Network: TBS VERY FUNNY BRAZIL",
"Network: TBS VERY FUNNY PANREGIONAL H",
"Network: TURNER CLASSIC MOVIES",
"Network: TURNER CLASSIC MOVIES ARGEN",
"Network: Warner Channel Andes",
"Network: Warner Channel Mexico"
)
THEN "YES"
ELSE ""
ENDIF

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Joe_Mako

 

We're on the same wavelength you and I!

 

See you at Inspire :)

Alteryx ACE & Top Community Contributor

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

Both seemed to be along the same line. Second one was just a little easier to read as it was listed. Either way thanks to both of you for your help. 

SeanAdams
17 - Castor
17 - Castor

Hey @jobytrice

 

In cases like this where you are using a large number of static strings - another way to do this (which is a neater and easier to debug) is:

- Create a text input where you list these strings.   You could call the input something like "InScope"

- Then use a basic join to your main data set, joining on this field

 

Given that the join has 3 outputs:

L: will be all the rows that don't have one of these values

J: will be all the rows that do have one of these values

R: will be a list of all the values that didn't appear on a row

 

The thing I like about doing it this way is that you can easily bring a spreadsheet into a text-input in seconds, and a join takes seconds - so you can be up and running incredibly quick and if you need to change anything you don't need to mess around with a complicated formula.

 

That doesn't take away from the work of @Joe_Mako and @MarqueeCrew - if you want to use the formula, their solution is the right way to do it.

 

Cheers @jobytrice

Sean

 

 

KenMoorhead
7 - Meteor

@SeanAdams wrote:

Hey @jobytrice

 

In cases like this where you are using a large number of static strings - another way to do this (which is a neater and easier to debug) is:

- Create a text input where you list these strings.   You could call the input something like "InScope"

- Then use a basic join to your main data set, joining on this field

 

Given that the join has 3 outputs:

L: will be all the rows that don't have one of these values

J: will be all the rows that do have one of these values

R: will be a list of all the values that didn't appear on a row

 

The thing I like about doing it this way is that you can easily bring a spreadsheet into a text-input in seconds, and a join takes seconds - so you can be up and running incredibly quick and if you need to change anything you don't need to mess around with a complicated formula.

 

That doesn't take away from the work of @Joe_Mako and @MarqueeCrew - if you want to use the formula, their solution is the right way to do it.

 

Cheers @jobytrice

Sean

 

 


Using the Join tool as a filter for multiple values is one of my favorite things I've discovered as a new user!

Labels