Avoiding global identifiers or redefining the ID (Sort Field)

Traveller's Avatar

Traveller

26 Apr, 2013 07:50 PM

I have the following fields in my decks:
ID: Sort Field, Identifier (a short string and/or a number)
Source: Indicates from where the vocable is (a letter for the book and a page number)
Front: The front text
Back: The back text
Comment: Text for hints

When I started with Anki, I didn't realize that the values used for the Sort Field must be unique for all decks.
I thought that every deck was independent from each other. Therefore I used a rather simple rule to create the IDs.
Later I've seen that imports to a deck with IDs that are used in other decks would overwrite the entries in the other decks.
Is there an option to avoid this behavior?
If not, isn't this a potential risk that using decks from different sources could mess up the data base?

If it's not possible to avoid global IDs, I would redefine my rule for creating the IDs.
At least I would do that for my future decks.
Though for conformity, it would be good that the IDs for the already existing decks would be altered using the new rule.
I've seen, I could do that using Find and Replace.
For instance if I would like to prefix the old ID with the string "Xyz ", I would enter:
Find: (.*)
Replace With: Xyz \1
In: ID
+: Treat input as regular expression

This manner the IDs can be set very fast to new values.
But I'm not sure, if doing so, there is a risk of loosing internal data (e.g. scheduling or statistics).
Can I alter the IDs without doing any harm to the data base?

  1. 1 Posted by Soren Bjornstad on 27 Apr, 2013 04:55 PM

    Soren Bjornstad's Avatar

    If you use a different note type for each deck, the cards will not be
    considered duplicates. You can create multiple copies of a note type and
    name them different things using Tools → Manage Note Types. Then you can
    change the cards to different note types in the browser with Edit → Change
    Note Type.

  2. Support Staff 2 Posted by Damien Elmes on 28 Apr, 2013 06:59 AM

    Damien Elmes's Avatar

    While using different note types for different decks is a good idea in this
    case, in answer to your question it is safe to apply a transform to the
    first field, as Anki does not use the user-provided data internally.

  3. 3 Posted by Traveller on 29 Apr, 2013 06:57 AM

    Traveller's Avatar

    Thank you both!
    Very well done.

  4. 4 Posted by Soren Bjornstad on 29 Apr, 2013 11:30 AM

    Soren Bjornstad's Avatar

    Please let us know if you have any further issues.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac