Duplicate Fields With Values

Here’s a question from left field.

I have a large deck of 1000+ that contains a particular field that contains many Unicode characters that doesn’t sort the way I want. E.g., Characters with certain diacritical marks like macrons (e.g., ā) all sort to the bottom, as though the sorting were being done on the Unicode codepoint value rather than a case-folded value of the letter.

So, to be specific, I want this sort order:
aec, āio, art, ātm, azz
NOT aec, art, azz, āio, ātm
as is currently the case.

As I wouldn’t dare to suggest that Anki change something as fundamental as its sort ordering code on my account, I’m content to implement a workaround, which would be to add a duplicate of the existing field, along with the values from the original field, except for case-folding of the characters not in the Latin-1 character-set. I’m happy to do this case-folding by manual editing. I just don’t want to have to copy all the values from the original field to the duplicate field. But, unless I am overlooking something, I see no function in Anki desktop to accomplish this.

However, I do note that Anki uses SQLite3 database as its data engine. Since I’m au fait with SQLite, I’m happy to tweak the collection.anki2 data file directly. But, this seems risky.
So, my question is, if I manually edit the data file, will this break my deck or otherwise possibly put it in an inconsistent state that Anki will have trouble dealing with?

Many thanks in advance.

  • Scott
1 Like

As I peruse the database-related code on GitHub with an eye toward direct modification of the database, it’s starting to look like it’s going to be a lot more trouble than it’s worth. Maybe I just need to rebuild my deck from scratch by exporting, adding my sort field, and importing again. But presumably this means I will lose all my study/review data, which would be a real drag.

Any better ideas?

Thanks again.

Are you creating cards from time to time or do you have them all already? If the latter you can create a new field and assign a number an sort by it. Alternatively copying the content and deleting the diacritical marks etc. I actually do this approach when generating cards for the same purpose as you. If your case is the former, I guess you could still sort it out via add-on.


Thanks for your reply.

Yes, my cards are already existing. And, yes, as you suggest, adding a new field and copying the values into that field would be feasible, but for the fact that I have almost 1,000 cards. I’m trying to find a more efficient solution than manual copying and pasting.

you can use Advanced Copy Fields to copy content of a field to another field without having to do it manually


This is exactly what I was looking for. Thank you so very much.