Sorting by UDC Classification Number

Any trouble you encounter with the Pedias, here's the place to ask for help.

Sorting by UDC Classification Number

Postby deano27 » Sat Apr 17, 2021 10:18 am


I am setting up a 6,000 item library using Bookpedia. To categorise and index the items I am using the UDC (Universal Decimal Classification) system. It was no problem to add a UDC field in the "Add Edit Panel", and no problem to display this field in the Library View. The problem arises when sorting on this custom UDC field.

For example, the UDC numbers for eight books that appear in sequence on a shelf are:
005; 005.2; 005.21; 005.322; 005.591.6; 005.6; 005.62; 005.96

but when sorting these from the Library View by selecting the UDC Column in increasing order with ^, the order appears as:
005; 005.2; 005.6; 005.21; 005.62; 005.96; 005.322; 005.591.6

I note that when I put the same UDC numbers into the default "Dewey Field", select the Dewey Field to display in Library View, and then sort this column in the same way as my custom UDC numbers, the numbers sort in correct order.

Clearly the "Custom" field that I am using to make my UDC entry, is defaulting as ASCII or something, hence the funny sorting. Is there a way to designate the content of a Custom Field so that I get a proper and consistent sorting?

Thanks for any help!
Posts: 1
Joined: Sat Apr 17, 2021 9:50 am

Re: Sorting by UDC Classification Number

Postby Conor » Mon Apr 19, 2021 3:54 am

Thank you for the clear and detailed explanation.

There is a special custom sorting going on for the dewey field as well as for price and number fields.

I though about it for a while and came up with looking for the number sign # in the name of the custom field. It will then use the custom sorting for price that will then sort correctly, instead of sorting alphabetically.

Download the beta version and then you can name your custom field "UDC #", the number sign can be in any place in the name. Sort some other column and then resort by UDC, it should see the number sign and sort correctly.
User avatar
Top Dog
Posts: 5296
Joined: Sat Jul 03, 2004 12:58 pm

Re: Sorting by UDC Classification Number

Postby FineWine » Mon Apr 19, 2021 3:02 pm

What an elegant solution Conor and obviously a simple piece of coding.
User avatar
Addicted to Bruji
Addicted to Bruji
Posts: 623
Joined: Wed May 28, 2008 2:41 am
Location: Tauranga, New Zealand

Return to Support