community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
#SANTALYTICS

Gather all 9 clues to complete the final Weekly Challenge on Dec 16!

Learn More
SOLVED

Malformed if Statement

Highlighted

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

Alteryx Certified Partner
Alteryx Certified Partner

@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 reboot. Order shall return.
Quasar
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

Alteryx Certified Partner
Alteryx Certified Partner

@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 reboot. Order shall return.

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. 

Nebula
Nebula

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

 

 

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