Frequently Asked Questions
Frequently Asked Questions
HOWTO: Change items' sort order in value lists
Posted by Timo Lahti (M-Files) on 30 September 2019 04:05 PM

Version 1.0 | Last Updated 30 September 2019

1     Overview

This article describes of how to easily change items' sort order in value lists. In this example, we have a value list with items named so that there is a number in the beginning ("16_Device", "148_Part", "150_Tool", "162_Vehicle" …).  In the metadata card when selecting a property and opening the dropdown list where this value list is used user may expect that list items are sorted alphabetically. M-Files sorts the value list items character by character. It does not understand numbers in this context. The sorting goes like this "148_Part" -> "150_Tool" -> "16_Device" -> "162_Vehicle". This doesn't seem logical for an user since 16 should come before 148.

A value the M-Files compares has to be either equal or less to be displayed before another. Number are considered to be smaller than alphabets.

1 = 1

1 < 6 and

8 < (space)

4 < a

 Because all characters in "148" fill this criteria "148" is displayed before "16 ". With this logic the list is in order from M-Files point of view.

2     Solution

Value list items would need to have leading zeroes in the number because value list items are character strings.

So if the value list item "16_Device" is renamed to "016_Device" then it falls in to a logical place in the drop down menu"


3     Other Info

Please note also: Items displayed initially on the drop-down list include only the first 50 values retrieved from the data source. It is not guaranteed whether the list would include a specific range of items within those first 50 hits.

In practice the list could seem unordered until the full list of items is opened by the user - Therefore it may seem that items starting with "152" to "159" would be missing. However, you will still see these items listed if you first type at least a few matching characters - Such as "15" into the property field. Then each item containing "15" will be displayed.

(0 vote(s))
This article was helpful
This article was not helpful

Help Desk Software by Kayako case