Hey, I'm Talking To You!

How To Convert Anki Tags to Fields

By , 4 September 2010

How To Convert Anki Tags to Fields

Previously I had been using anki tags to record the parts of speech (verb/noun/adjective etc) for the words I learn. However, as I have way too many tags and never filtered using those tags, I decided to create a POS field in my model. Converting the tags to fields was more difficult than it should have been because SQLite didn't play well using a subquery with a condition in my UPDATE statement.

My eventual workaround was to use the following SQL statement once for each tag I needed to convert. Perhaps you will find it useful. Each time you run the query you need to change the tag value in two places, and also the name of the new field if necessary.

update fields set value='noun'
 where fieldModelId=(select id from fieldModels where name='POS')
       and factId in 
 (select facts.id from tags
                  join cardTags on cardTags.tagId = tags.id
                  join cards on cardTags.cardId=cards.id
                  join facts on cards.factId=facts.id
  where tag = 'noun');
How To Convert Anki Tags to Fields
 

About Roger Keays

How To Convert Anki Tags to Fields

Leave a Comment

Please visit http://languages.getsunburnt.com/blog/how-to-convert-anki-tags-to-fields to add your comments.

Follow Us

Join the Mailing List

Subscribe to our mailing list for the latest news and announcements.


Join the Mailing List

Subscribe to our mailing list for the latest news and announcements.

    Latest Poll

    The Hardest Language You've Studied Is
    English
    French
    Spanish
    German
    Japanese
    Chinese
    Korean
    Russian
    Hebrew
    Latin