The CreatorCon Call for Content is officially open! Get started here.

Sorting numbers in Demand list view.

syGoC
Tera Contributor

Hello everyone, 

 

When users are sorting by ZA in the Demand list view the numbers are sorting in the order of 91, 9, 89, 86, 8.

 

I was expecting it to sort by the actual value of 91, 89, 86, 9, 8.

 

Is there something I can do to fix this sorting issue.

 

Many thanks.

5 REPLIES 5

Mark Manders
Mega Patron

What field is that? And what field type? I just checked on my (Zurich) instance on an integer field and it showed the expected order (20 on top, next one 6.0.3, etc). If it's a string field, it just checks the first character and orders by that.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Thanks a lot Mark. I did check and it is STRING but I am unable to change it to INTEGER as I cannot choose that as per the attachment.

TejasSN_LogicX
Tera Contributor

Hi @syGoC ,

This happens because the field you’re sorting on is being treated as text instead of a number. When ServiceNow (database) sorts string values, it sorts them alphabetically — so "9" comes before "89" and "91", which causes that strange order (91, 9, 89, 86, 8).

 

so .....

If the field type is String, change it to Integer , depending on your data.

Once it’s numeric, sorting will happen by actual value, not alphabetically.

 

 

 

 

If my response helped you, please mark it as the correct answer and close the thread. This way, others in the community can benefit too.

Regards,
TejasSN_LogicX
ServiceNow Developer | HackaNow Finalist | Community Contributor
📧 tejas.adhalrao11@gmail.com
🔗 LinkedIn

Thank you very much, I did check and it is STRING but I am unable to change it to INTEGER as I cannot choose that as per the attachment.