Skip to main content
Inspiring
December 1, 2023
Solved

Expecting to throw validation message "Please enter numeric value" but the code doesn't

  • December 1, 2023
  • 2 replies
  • 4 views

Hi All,

I am using Appian 23.2 version, using text field to validate percentage value for a float/number data type column but Appian not throwing error when I entered text value, instead, Appian automatically removing text and only defaulting numeric value if any in the entered text.

Few scenarios:

a1.25 - Should error message

10.s2 - Should error message 

10 - Should allow to proceed

10.25 -  Should allow to proceed.

I have tried with integer field also but no luck, seems I am missing something.

Please help me on this validation. Thanks in advance.

a!localVariables(
  local!percentagenum: 99.99,
  a!textField(
    label: "Percentage",
    value: ri!spx_Launch['recordType!{97e19909-9b98-4335-a811-7472bde63ac3}SPX Launch.fields.{39ad4217-f104-46d2-a63c-06b17a945271}flight_number'],
    saveInto: ri!spx_Launch['recordType!{97e19909-9b98-4335-a811-7472bde63ac3}SPX Launch.fields.{39ad4217-f104-46d2-a63c-06b17a945271}flight_number'],
    validations: if(
      len(
        ri!spx_Launch['recordType!{97e19909-9b98-4335-a811-7472bde63ac3}SPX Launch.fields.{39ad4217-f104-46d2-a63c-06b17a945271}flight_number']
      ) = 0,
      null,
      if(
        len(
          cleanwith(
            ri!spx_Launch['recordType!{97e19909-9b98-4335-a811-7472bde63ac3}SPX Launch.fields.{39ad4217-f104-46d2-a63c-06b17a945271}flight_number'],
            "0123456789"
          )
        ) = if(
          find(
            ".",
            ri!spx_Launch['recordType!{97e19909-9b98-4335-a811-7472bde63ac3}SPX Launch.fields.{39ad4217-f104-46d2-a63c-06b17a945271}flight_number'],
            1
          ) > 0,
          len(
            ri!spx_Launch['recordType!{97e19909-9b98-4335-a811-7472bde63ac3}SPX Launch.fields.{39ad4217-f104-46d2-a63c-06b17a945271}flight_number']
          ) - 1,
          len(
            ri!spx_Launch['recordType!{97e19909-9b98-4335-a811-7472bde63ac3}SPX Launch.fields.{39ad4217-f104-46d2-a63c-06b17a945271}flight_number']
          )
        ),
        null,
        "enter valid number"
      )
    )
  )
)

Thanks

Best answer by satyanarayanac2070

Great! This is working as expected. Thanks

2 replies

annap0005
Participating Frequently
December 1, 2023

Any specific reason that you are using textField? if no then use a!floatingPointField

satyanarayanac2070AuthorAnswer
Inspiring
December 1, 2023

Great! This is working as expected. Thanks