Sorting on section numbers, like 1.02.05 doesn't work

This is on the latest version of Anki on the latest version of MacOS.

I’ve created a few new note types. Each of the types is a normal note type like Cloze where I’ve added a new field called Section. I’ve gone into each of the new card types and made sure that the Section field was selected for “Sort by this field in the browser”. In the section field, I zero pad the numbers like this: 1.02.05 so that I don’t get tripped up by the alphabetical only sorting.

When I do this the sorting mostly works. It’s mostly in order by Section, but there are discrepancies like 1.03.03 coming before 1.03.01

This happens if I sort by Sort Field or Section in the Browser.

Any ideas what’s going on?

When I see discrepancies like this, it’s because I’ve just changed something in a note (or many notes), which is now visible in the table, but it’s not yet the value that Anki is using to sort. However if I re-run the search, Anki will start using the new value. Have you tried that?

Or what about Tools > Check Database?

The next thing I would check is the HTML view of those fields, character-by-character, to see if there’s anything hiding in there that could be causing sort differences.

Thanks for the suggestions!

  • When I’m in Browse mode, I have noticed that I have to switch away from the deck for new cards or other changes to be reflected – Switching away from the deck and back does not change the sort behavior
  • I checked the HTML view of the fields – No characters other than expected
  • I did the Tools > Check Database – No errors.

This was supposed to fix that Add option to automatically refresh card browser by voczi · Pull Request #3238 · ankitects/anki · GitHub :pensive:
BUT, I did say that I wanted to try making an addon…

This might sound crazy – but since you didn’t mention it, I have to ask! Are you sure you are sorting by that column in Browse? What about when you reverse the sort on that column?

You mention having several note types mixed together. Does the sort work if you limit the search to just a single note type first?

If you have both of those available as columns, that tells me you have some add-on that is making it possible. Have you tried disabling your add-ons? – step 2 in Troubleshooting - Anki Manual

I opened your AnkiWeb collection, clicked on the sort field column to sort on it, and observed the section numbers being ordered correctly. Please provide the steps we should take that triggers the issue for you.

1 Like

In the Anki Browse window go to Decks → CISSP HPH → Domain 1

Click on the top of the Sort Field and. . . it sorts correctly. It didn’t yesterday.

Ah well. Now I am that person that says, “But it was broken a minute ago, it just started working!” Usually I’m on the receiving end of that phrase.

Thanks everybody for your help.

1 Like

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