Sorting by UDC Classification Number

Any trouble you encounter with the Pedias, here's the place to ask for help.
Post Reply
User avatar
deano27
Contributor
Contributor
Posts: 6
Joined: Sat Apr 17, 2021 9:50 am

Sorting by UDC Classification Number

Post by deano27 »

Hi,

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!
User avatar
Conor
Top Dog
Posts: 5335
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Sorting by UDC Classification Number

Post by Conor »

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
FineWine
Site Admin
Posts: 852
Joined: Wed May 28, 2008 2:41 am
Location: Tauranga, New Zealand

Re: Sorting by UDC Classification Number

Post by FineWine »

What an elegant solution Conor and obviously a simple piece of coding.
User avatar
deano27
Contributor
Contributor
Posts: 6
Joined: Sat Apr 17, 2021 9:50 am

Re: Sorting by UDC Classification Number

Post by deano27 »

Hi,

For whatever reason I did not realise that you had answered my question on sorting by UDC code. I have been attempting some workarounds, but it doesn’t really work very well. I’m just wondering if the answer you gave last year in April (downloading the beta version) is still valid? Or has this now been incorporated into a general update that I should get.

I need to figure out how to turn on notifications for this Forum.

Great product by the way. It is getting a lot of use in our library!
User avatar
deano27
Contributor
Contributor
Posts: 6
Joined: Sat Apr 17, 2021 9:50 am

THANK YOU!! - UDC Sorting

Post by deano27 »

Hi again,

Just renamed the custom field to UDC # as you suggested. On resorting it looks like everything works perfectly. This is just great! Thank you so much. The UDC designators can get a bit funny looking, but your fix sorts most of them all perfectly, even those with the funny suffixes (so for example, 005.5’068 sorts before 005.511(675.05)).

I have to check that the funny prefixes sort correctly, but so far it seems ok. For example, UDC 005.966 sorts before 050.9.

Thanks again!
User avatar
FineWine
Site Admin
Posts: 852
Joined: Wed May 28, 2008 2:41 am
Location: Tauranga, New Zealand

Re: Sorting by UDC Classification Number

Post by FineWine »

Great to hear Conor's code modification works for you. :D
User avatar
deano27
Contributor
Contributor
Posts: 6
Joined: Sat Apr 17, 2021 9:50 am

Re: Sorting by UDC Classification Number

Post by deano27 »

Well, this seems to have worked for a while - but now, unexplicably, the fix for UDC sorting by adding a “#” in the Custom Field Name no longer seems to work. I’ve sorted on other columns, then re-sorted on the UDC # column, and no matter what I do it does not sort in order. I get the following sort:
005.32
005.322
005.322:316.46
005.322
005.332.3
005.332.3
005.332.4
005.332.4
005.332.3
005.332.3
005.334.2

Any ideas how to fix this?
Thanks!
Post Reply