Skip to main content
tejasn0320
Inspiring
Apr 4, 2024 11:49 AM UTC
Question

Sort Text field as Integer on record Grid

Hello,

I have a field for mobile numbers in my Appian application, but it is in text format instead of integer. Appian does not support 10 digits as an integer, so I cannot change it. I need to sort this mobile number field on a read-only grid, but it is sorting as a string due to the text format. I need it to be sorted as an integer field.

13 replies

shubhama926776
Brainy
Apr 4, 2024 12:24 PM UTC

Do you want to leverage Appian grid sorting on a column? I mean when you click on the column header, it sorts.

शुभम्
shubhama926776
Brainy
Apr 4, 2024 12:27 PM UTC

To sort mobile numbers as integers in an Appian readonly grid:

Create a hidden integer field in your data source.Convert text mobile numbers to integers and populate the hidden field.Include both text and hidden integer fields in the grid.Configure the grid to sort based on the hidden integer field.

शुभम्
stefanhelzle0001
Brainy
Apr 4, 2024 1:47 PM UTC

"Numbers" like phone/ZIP/ID/street, are not to be stored as numbers! While in some countries these values are numeric only, in many countries they are alpha-numeric.

harshk1671
Inspiring
Apr 8, 2024 10:47 PM UTC

Can you explain what do you mean by integer sorting and text sorting here?

mikes0011
Brainy
Apr 9, 2024 2:37 PM UTC

If you sort as text, "9" would sort AFTER "1234", while as integers, 9 would sort BEFORE 1234.

The Expression Guru
harshk1671
Inspiring
Apr 9, 2024 2:51 PM UTC

In the current scenario the length of phone numbers is mostly same or may differ by one digit. Keeping the phone number as text and use the default grid sort will work, if I am not missing something specific here.

mathieud0001
Genius
Apr 9, 2024 12:22 AM UTC

Like other have already mentioned, I would recommend storing phone numbers as text.

It's quite easy to validate a phone number and formatting it as a string on save. You could even create a Custom Record field that strips all the formatting characters to help with the sorting.

Appian even has an example on how to create such a field: docs.appian.com/.../fnc_text_isphonenumber.html

Participating Frequently
Apr 9, 2024 1:24 PM UTC

[mention:ae9ebe781c79465582221db39f6b7db9:e9ed411860ed4f2ba0265705b8793d05] ,

I think you can make on custom record field with type decimal and cast this text field to decimal then use this custom field for the sorting, if you are using record as data source