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

Multi Row Formula tool-Help!

Coakles
7 - Meteor

I'm stuck on this tool. I'm trying to use the results in the current row to create a new field that indicates if the second row meets the criteria.  I keep getting a malformed If statement and it's got to be something easy, I'm just stuck.

 

IF [Account]="Primary" and [Indicator]="Ok" and[Row+1:Units]>"0" then "SecondaryOK"

Else ""
ENDIF

 

I can add more if needed but hoping someone can look at this and see what I am messing up. thanks!

 

 

(sorry-i misscopied)

8 REPLIES 8
apathetichell
19 - Altair

if statements require an else value so you have to add a base condition like Else [Units]

Qiu
21 - Polaris
21 - Polaris

You put quotes on 0 meaning you are using it as string. String can not be compared try to remove the quotes for both side of 0.

IF [Account]="Primary" and [Indicator]="Ok" and[Row+1:Units]>"0" then "SecondaryOK"
ENDIF


 

Coakles
7 - Meteor

I tried without the quotes on the zero and still not working. 

Coakles
7 - Meteor

sorry-i had the else just didn't copy it in. 

Amilley
8 - Asteroid

A few debugging suggestions:

 

First, check the meta-data on all your field types. You used quotes in your logic so everything should be a string, just confirm that (use the select tool or the Metadata toggle in the results window)

 

Second, by default if you are creating a new field with the multi-row - the field type defaults to INT32. Your then statement again is trying to create a string, adjust the config options to V_Wstring, that might be the solve

 

Lastly, if none of that works, check for things such as Spaces , Casing and Spelling - string logic is always susceptible to little nuances like that

Amilley
8 - Asteroid

One last thing - I just re-read you logic. > "0" isn't going to work, go back up stream (before this tool) and make sure units is a numeric field type, then go back to your logic and remove the "" around 0

Coakles
7 - Meteor

Thanks everyone---I literally needed a space. Appreciate everyone helping and that's @Amilley the space did it. Happy Friday ya'll!

IF [Account]="Primary" and [Indicator]="Ok" and[Row+1:Units]>"0" then "SecondaryOK"

Else ""
ENDIF

 

IF [Account]="Primary" and [Indicator]="Ok" and [Row+1:Units]>"0" then "SecondaryOK"

Else ""
ENDIF

Amilley
8 - Asteroid

@Coakles - it's always the little things w/ strings! 

 

Glad that it worked, have an amazing Friday!

Labels