Card Creation Despite Blank Fields

Having trouble with multiple cards being created despite blank fields… want to have these cards created only if there is text in the fields. See template HTML below:

Front Template:


{{Front A}}

Back Template:


{{Front A}}

{{Front B}}
{{Front C}}
{{Front D}}
{{Front E}}
{{Front F}}
{{Front G}}
{{Front H}}
{{Front I}}
{{Front J}}
{{Front K}}
{{Front L}}

{{#Back A}}

{{Back A}}

{{/Back A}}

{{#Back B}}

{{Back B}}

{{/Back B}}

{{#Back C}}

{{Back C}}

{{/Back C}}

{{#Back D}}

{{Back D}}

{{/Back D}}

{{#Back E}}

{{Back E}}

{{/Back E}}

{{#Back F}}

{{Back F}}

{{/Back F}}

{{#Back G}}

{{Back G}}

{{/Back G}}

{{#Back H}}

{{Back H}}

{{/Back H}}

{{#Back I}}

{{Back I}}

{{/Back I}}

{{#Back J}}

{{Back J}}

{{/Back J}}

{{#Back K}}

{{Back K}}

{{/Back K}}

{{#Back L}}

{{Back L}}

{{/Back L}}


From the docs:

You can also use conditional replacement to control which cards are generated. This works since Anki will not generate cards which would have a blank front side. For example, consider a card with two fields on the front:


Normally a card would be generated if either the expression or notes field had text in it. If you only wanted a card generated if expression was not empty, then you could change the template to this:


Is there a way to retroactively change the code to delete cards that have been created without the conditional formatting image ? I tried this but the cards still exist…

Another snippet from the manual:

When you edit a previously added note, Anki will automatically create extra cards if they were previously blank but no longer are. If your edits have made some cards blank when they previously were not, however, Anki will not delete them immediately, as that could lead to accidental data loss. To remove the empty cards, go to Tools → Empty Cards in the main window. You will be shown a list of empty cards and be given the option to delete them.

1 Like