Order by identifier

I have some resources with an identifier.

When I’m on the public website, I can search among items and set the ordering criteria as:

Identifier | Ascending | Sort

So the items should be ordered by Identifier criteria, in an ascending order.

But the result is different:

1
10
100
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
101
1010
1011

It appears that item are ordered alphabetically where I was expecting a numeric ordering.

I have to say the I have declared a resource template where the identifier field is declared as an integer.

Have I done something wrong, or is there a bug here?

If your identifiers are integers, you can use the module Numeric Data Types, so order will be numeric.

I already have this module installed (last version, 1.4.0), but nevertheless it doesn’t work.

I am maybe using it wrong, but the module has almost no documentation.

Could you please help me using it properly?

My identifier is already an integer, so it should work, no?

To enable numeric sorting, you’ll need to convert your identifiers to integers. Here’s how you do this. Perform an advanced search for all items that have an identifier. Then, under “Batch actions,” select “Edit all” and click “Go.” Then, under “Convert to numeric,” select the identifier property and “Convert to integer,” then click “Save.” Once this is done you should see an additional sorting selection, something like “Identifier (numeric:integer)”. Select this to sort integers in numeric order.

Great thanks @jimsafley, it works!

It was hard to guess as there is no manual for this extensionk but with your help it become easy to achieve!

I just want to clarify that there is a manual for that module: you get there from the Manual link on the module page you mentioned earlier.

Thanks for pointing out the link to the manual.

It would be great to add a link to the manual in the GitHub repository of the module, for those who - like me - are goign straight to the GitHub repository before opening their eyes… :expressionless:

:wink:

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.