There seems to be a bug in the logic for user defined lists. For example,
I am attempting to populate "userlist1" with names of attorneys that represent our workers comp patients. This way I can have the attorney name in the patient chart. This list grows throughout the year for us.
I randomly inserted names out of alphabetical order to test the logic. It alphabetizes them properly for the first few entries. However, after about 8 or 9 entries the logic displays the entries out of alphabetical order. The format that I would like for the entries is: lname, fname, mname.
Below is the order that the logic displays the names after 8 or 9 entries.
******** ID ****************** Title ******** ***Order***************
Belford, Robert C. Belford, Robert C. 0
Ellis, Jospeh Ellis, Jospeh 0
Chester, Steven B. Chester, Steven B. 0
Cass, Bessie J. Cass, Bessie J. 0
Brown, Richard W. Brown, Richard W. 0
Blue, Aaron Blue, Aaron 0
Black, Tom Black, Tom 0
Bellows, John Bellows, John 0
Bell, John Bell, John 0
Falloon, Brian M. Falloon, Brian M. 0
I see. Although, it is peculiar how the logic did sort the first few entries alphabetically when I intentionally entered them out of alphabetical order for testing ( while also leaving ‘order’ the same value).
I like the idea of using a list box for entering the names of the attorneys that represent our WC patients. However, renumbering the list box with each new entry could become a bit cumbersome as the list grows.
Would it be ok for me to modify the SQL on ‘userlist1’ to sort by ‘Title’ rather than ‘Order’? Which file contains the SQL for these lists boxes?
I think a better solution, and a good improvement generally, would be to sort by Title *within* Order.
To find the relevant code, try searching for the string "ORDER BY seq". Make sure the SQL in question deals with the list_options table. Then change it to "ORDER BY seq, title". See what that does for you.
This worked Rod. Thanks! The code is in file library/options.inc.php.
Would it be possible to add a feature so that the one could customize the SQL that populates the user defined selection lists? Ideally I would like to populate this user defined selection list with values from the address book ( users table).