Anki Forums

Why are cards created despite using Selective Card Generation?

Hi y’all,

I tried out the selective card generation:
https://docs.ankiweb.net/templates/generation.html#selective-card-generation

I created a field called {{generate card}} that I would populate with the value 1 if I want a card to be created. If not, I leave the field empty.

I wrap the front side of the card with the following:
{{#generate card}}

{{/generate card}}

I thought that this would suppress the creation of the card if field {{generate bold}} is empty.
Instead when I select the deck to study it, I still see the corresponding cards with this message:
The front side of this card is empty.
More information
(Die Vorderseite dieser Karte ist leer.
Mehr Informationen)

Is this how it is supposed to be?

Thank you!

I created a test deck to test the concept.
Selective card generation doesn’t seem to work.
{{#Selective}}
{{Front}}
{{/Selective}}

selective1

I added a note with an empty value for the field Selective.

The card appears as new nonetheless.
selective2

The card gets generated nonetheless.
selective3

Is this a bug?

This is intentional. Please see Card Generation - Anki Manual

2 Likes

Thank you for the link.

The paragraph mentions the Empty Cards function.

When I try to use it, then I get a blank window:

emptycard

Is this how it is supposed to be?
Do I have to click on delete?
Only the cards are deleted, not the corresponding notes?

Or how do I suppress the creation of a card using selective card generation?
I was following the instruction in this text:

Selective Card Generation

Sometimes you may want to generate extra cards for only some of your material, such as testing your ability to recall the most important words of a set. You can accomplish this by adding an extra field to your note, and adding some text into it (such as “1”) on the notes you want the extra card. Then in the card template, you can make the card’s creation depend on that field being non-empty. For more information on this, please see the conditional replacement section below.

You can only suppress the creation of cards generated from extra card templates. At least one card will always be generated from a note. You only have a single template in the note type in your example (I guess), so a card will always be created from the first template.

Regarding the Empty Cards function, I think the empty card should be shown as in this screenshot:
image

Toggling on “Keep notes with no valid cards” will keep the empty card even if you click Delete because deleting it will also delete its note. Keeping the note with its empty cards is useful for the reasons outlined in the manual.

If you’re having problems with using this, maybe try to rule out add-ons as explained in the FAQs: When problems occur - Frequently Asked Questions

1 Like

Thank you.
I missed the part with the “extra” card templates.
I was just testing it without making sure that there is an initial card to begin with.
It is working now.
Thanks!

extracard

No 2nd dog card is generated.

1 Like