Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Expressions in Error Message tool (analytic app)

MCDR929
8 - Asteroid

Hello,

 

I've browsed the tool mastery sessions on the Error Message tool, but was unable to find what I need.

 

I am building an app with multiple questions - some are drop-downs, some are free form text.

 

For the free form text tools, I have a field that must begin with the letter "i".  I want an error message to appear when the user has omitted the i. 

 

I also need to restrict one of the entry tools so the user receives an error message if they enter anything other than numeric values.

 

I've been unable to find the right expressions to use within the error message tool.  For the first one, I tried Startswith([#1], !"i") - but the message is that I tried to apply a string operator to a numeric value.  I'm sure there is a better way to do this.  Looking forward to your assistance!

 

Thank you,

Molly

6 REPLIES 6
LukeM
Moderator
Moderator

Hi @MCDR929 

 

For the first one you'll want something like:

 

Left([#1],1) != "i"

Which takes the first character on the left and tests whether it is not equal to "i".

 

For the numeric characters, you can use a regex expression to test to make sure there are only numerics:

 

REGEX_Match([#1], '[^0-9]')

This should work - it will return true if there are any characters that are not 0-9.

 

Let me know if this works for you.

 

Luke

 

MCDR929
8 - Asteroid

Hi @LukeM ,

 

The first one worked, but not the REGEX expression.  This isn't something I've used at all before.  Is there anything additional I need to do before using REGEX expressions? 

 

Thank you,

Molly

 

 

LukeM
Moderator
Moderator

So sorry @MCDR929 that was my laziness.

 

What you actually need to use is:

REGEX_CountMatches([#1], '[^0-9]') > 0

This is going to count how many occurrences of non-numeric characters there are and error if there are more than 0.

 

RegEx is a way of describing characters, letters, numbers etc in certain patterns. If you're interested, https://regexone.com/ is a very good learning resource.

 

Luke

MCDR929
8 - Asteroid

@LukeM - This is great!  I'll be sure to check out the Regex resource you provided.  I appreciate it.

 

 

Thanks,

Molly

JTCairns
8 - Asteroid
Have you tried
!startswith([#1],"i")
I seem to remember the error message tool needs the expression to evaluate to True
JTCairns
8 - Asteroid
... and for the numeric use the numeric up down with 0 decimal places?
Labels