Alteryx Designer Desktop Discussions

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

formula -end part

Hi2023
8 - Asteroid

Hi, 

 

Why wont it work? what am I doing to the end?

 

if REGEX_CountMatches([PAYEE ADDR 1] AND [PAYEE ADDR 2], "[A-Za-z]") > 0 then "Text"

elseif REGEX_CountMatches([PAYEE ADDR 1] AND [PAYEE ADDR 2], "[0-9]") > 0 then
"Int" else endif 

 

thanks

9 REPLIES 9
FinnCharlton
13 - Pulsar

Hi @Hi2023 , you are missing something between the 'else' and 'endif'. The formula requires that you put something in the 'else' clause so it knows what to return if neither of your conditions are true. You could use 'else null() endif' to return NULL if neither condition is true.

binuacs
20 - Arcturus

@Hi2023 you need to re-write the formula like below

IF REGEX_CountMatches([PAYEE ADDR 1], "[A-Za-z]")> 0 AND  REGEX_CountMatches([PAYEE ADDR 2], "[A-Za-z]") > 0 Then "Text"
elseif REGEX_CountMatches([PAYEE ADDR 1], "[0-9]")> 0 AND  REGEX_CountMatches([PAYEE ADDR 2], "[0-9]") > 0 Then 'Int' Else
Null()
EndIf

 

apathetichell
19 - Altair

I read it as [PAYEE ADDR 1] + [PAYEE ADDR 2] (concatenated string) - either way your problem is the AND  - AND is a boolean term. You can use it in Boolean compare - in strings you can use +...

Hi2023
8 - Asteroid

How would I write this to see for the text column- I wanted to check if there was ANY numbers in the column versus NO numbers in the column

binuacs
20 - Arcturus

@Hi2023 One way of doing this

binuacs_0-1683045362664.png

 

apathetichell
19 - Altair

Maybe like this?

Hi2023
8 - Asteroid

But I need this for PAYE ADDR1 

AND 

 

PAYE ADDR 2

binuacs
20 - Arcturus

@Hi2023 Do you need to I check both on the same formula, if yes as @apathetichell @suggested concatenate both fields then apply the formula 

 

ie [PAYEE ADDR 1] + [PAYEE ADDR 2] 

apathetichell
19 - Altair

use the workflow I uploaded. Select the fields you need in the multi-field.

Labels