Skip to main content
January 7, 2025
Question

valid Input

  • January 7, 2025
  • 4 replies
  • 0 views

Hi All,

I need to show one validation that - throw error if they enter anything apart from 0 to 9 and . 

How can we achieve that using some functions in appian

Can Someone suggest for this?

    4 replies

    gundamanen723137
    January 7, 2025

    Use regexmatch(). It will be useful to achieve your requirement.

    mikes0011
    Brainy
    January 7, 2025

    It really kinda depends on what valid input(s) you're trying to accept.  If you're after only decimal values, you could wrap your save in "todecimal()" at save time, forcing any extraneous characters to go away.  If something like "10.2.3.6.8.9" would be acceptable though, you'd need to check the text manually - a regex would work, but also you could just use built-in functions like "cleanWith()" i.e.
    validations: {
      if(ri!text <> cleanWith(ri!text, "0123456789."), "Invalid Characters Entered", null())
    }

    January 13, 2025

    Hi, 

    Thanks, this looks good and I have one more concern what if user provides 8..9.7 smtg like this(2 dot decimals) ?

    mikes0011
    Brainy
    January 14, 2025
    what if user provides 8..9.7

    all you said originally was "0 and 9 and ."  That doesn't exclude having 2 periods in a row.   If two periods in a row is not allowed, obviously your algorithm for validation will need to be a bit more complex.