Alteryx Designer Desktop Discussions

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

check data type of values in a column

SamSurya
8 - Asteroid

how to check if the values in a particular column are numeric or string or alpha numeric. Also, How to check datatype of a column. Please help

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

@SamSurya,

 

In a formula you can use an expression like:

 

IF 
regex_match([Field],"[A-Za-z]+") THEN "Alpha"	ELSEIF
regex_match([Field],"\d+") THEN "Numeric"	ELSEIF
regex_match([Field],"[A-Za-z0-9]+") THEN "AlphaNumeric"	ELSEIF
regex_match([Field],"[^A-Z,a-z]+") THEN "Printable Characters"	ELSEIF
regex_match([Field],"[^ -~]+") THEN "Non-Printable Characters"	ELSE
"Unknown"
ENDIF

 

If you use a multi-field formula, you can check the type with [_CurrentFieldType_].

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
SamSurya
8 - Asteroid

thank you Marquee

 

I'm getting following error:

Formula (31) Parse Error at char(0): Formula: tried to apply string operator to numeric value (REGEX_MATCH) (Expression #1)

deviseetharaman
11 - Bolide

Hi @SamSurya 

 

Please use tostring() function

if regex_match(tostring([Field]),"\d+") THEN "Numeric"

SamSurya
8 - Asteroid

Thank  you Mark & Devi. this works, however, not sure if 0 is treated under /d as in case 0's it's moving to else part which is Unkown 

Labels