Join the Inspire AMA with Joshua Burkhow, March 31-April 4. Ask, share, and connect with the Alteryx community!

Alteryx Designer Desktop Discussions

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

Set condition for those with 7characters only

PassION_es
10 - Fireball

Requesting your urgent help to provide the right formula or condition to identify each item.  My condition is here:

 

If ID is equal to 7characters then that the Tagging is "Staff" but if its starts with 3 zeroes (or more than 7 characters) then its a "vendor".

 

Input and Output sample:

 

ID - Tagging

1655222 - Staff

000632563 - vendor

000235103658 - vendor

 

Thanks

4 REPLIES 4
AshRez
8 - Asteroid

if Length([ID]) = 7 then "Staff"

elseIf Left([ID],3) = "000" and  Length([ID]) > 7 then "Vendor"

else "Unknown"

EndIF

alexnajm
18 - Pollux
18 - Pollux

A conditional IF statement in a Formula tool will do the trick! There are functions like Length and StartsWith that will help :)

binuacs
21 - Polaris
IF Length([ID]) = 7 THEN "Staff"
ELSEIF StartsWith([ID], "000") OR Length([ID]) > 7 THEN "Vendor"
ELSE "Unknown"
ENDIF

@PassION_es make sure your ID field is string data type , if it is integer then you need to use either  toString() function or add a select tool then change the data type to string

 

PassION_es
10 - Fireball

Thank you all.  Yes @binuacs , it is string data type.

Labels
Top Solution Authors