How to get conditional cards to generate?

I have a note with a field which, if set, generates an extra card. So by default there is always 1 card, and if that field is set, there is another card. This is a common pattern I’ve used for a while that has stop working when I import sentences.

For new sentences it still seems to be working fine. But if I import a bunch of sentences and then use find and replace to set that field to 1, the new cards aren’t being generated. Is there something I need to do to get them to be generated?

Could you provide the card template to see the conditionals you are using?

Sure, here you go


<div class="jpnstyle">






{{#Kana}}{{Kana}}<br/>Need furigana!{{/Kana}}

{{^Kana}}(Need kana and furigana!){{/Kana}}




{{#DisambigAudio}}D: {{DisambigAudio}}{{/DisambigAudio}}



Before I upgraded to the most recent version (2.1.29), I was on 2.0.x I believe and this had no problem. Now if I add a card directly with the PromptAudio field set, it will generate the card. But if I add a bunch of cards then set the field, or if I import them with the field set, it doesn’t generate properly. And I’m not sure if there’s a way to force anki to generate cards that should exist.

I guess thats the template for the second card type, which needs PromptAudio to be non-empty plus at least one field of the following: Audio or Reading or Kana or DisambigAudio, should be non-empty to generate a card. Have you checked the cards are created somewhere else? Like the default deck.

2.1.28 version some changes to card creation.

Card generation now supports negated conditionals, and a mix of required and optional fields.

All that should be required for the card to generate, at least under the old code, is for the PromptAudio field to be set. But something has changed and it’s not generating if i import or do a find and replace to set the field.

If you want the cards to be generated when PromptAudio is empty, then change the firstline # to ^ i.e.


I suspect “empty” was just a typo.

@chuangdangjianghu find&replace generates new cards for me using a simple example. Please export a share somewhere a single note that is missing the card, so we can try reproduce it using your exact note type and fields.

I’m not sure if it’s different, but I did indeed need to populate a field. I feel like before it was fine but unsure. Regardless, was able to resolve it