Skip to main content
Inspiring
January 23, 2024
Solved

21 digits number

  • January 23, 2024
  • 5 replies
  • 0 views

Hello All 

I want to add a field that accept only 21 digits of number I tried to use a!integerField but is not allowed to enter too long numbers 

Best answer by alaaa6815

Thank you [mention:391c81fddc8d46d3a321249e5a3d9057:e9ed411860ed4f2ba0265705b8793d05] 

5 replies

January 23, 2024

Hi [mention:bca0992588074b3b9d61ed5bf520bd26:e9ed411860ed4f2ba0265705b8793d05] 

You can use textField and validate the field if the user's input is not valid as integer field does not accept more than 10 digits.

January 23, 2024

Try the below code and lemme know if it works for you

a!localVariables(
  local!input,
  a!textField(
    label: "Text",
    labelPosition: "ABOVE",
    value: local!input,
    saveInto: local!input,
    refreshAfter: "UNFOCUS",
    validations: if(
      a!isNullOrEmpty(local!input),
      {},
      if(
        or(
          len(local!input) > 21,
          regexmatch("[^0-9.]", local!Input)
        ),
        "Invalid Input",
        ""
      )
    )
  )
)

alaaa6815AuthorAnswer
Inspiring
January 23, 2024

Thank you [mention:391c81fddc8d46d3a321249e5a3d9057:e9ed411860ed4f2ba0265705b8793d05] 

harshitb6843
January 23, 2024

The largest value integer can store on Appian is 2147483646 and after that, it takes it back to negative. 

Because you want to store 21 digits, you can use textField with length validation and another validation that makes sure the user is only entering numbers. 

a!textField(
  characterLimit: 21,
  value: ri!value,
  saveInto: ri!value,
  validations: if(
    a!isNullOrEmpty(stripwith(ri!value,"1234567890")),
    {},
    "Value can only contain numbers"
  )
)
 

NOTE - You will also need to change the Datatype of your CDT field, Record field, and DB column to text. 

alaaa6815Author
Inspiring
January 23, 2024

Thank you [mention:b8ea18cfbb2e4f6d841cf3c1d4d7420b:e9ed411860ed4f2ba0265705b8793d05]