Variability/alternating what Anki displays in the same card - is it possible?

Is there a way to alter a current card template to vary in what is displayed for a given field?
An example may make this easier to describe:

Lets say I had text followed by an image, but I wanted that image to rotate between 3 different pictures without having to make 3 different cards.
The text for the card would read: What kind of dog is this?
Then I would insert three different images specifying their frequency to be .33,.33,.34 respectively
Anki would display only one image when reviewing the card, but the frequency that it displays any given image would match what it was assigned to.

I’m imagining being able to create a card like normal, but in the text I could insert {var.xx:phrase1/image1;var.xxphrase2/image2;etc} (variability. %frequency: input to be displayed) into the Front field and anki will read that to alternate what is shown without having to make a new note for each image.

Following the example above with the format I’m describing would go as such:
FRONT:
What kind of dog is this?
{var.33:image1;var.33:image2;var.34:image3}
BACK:
{FrontField (with the same image displayed}
Answer

This is achievable with some JavaScript and Anki Persistence, but the real question is whether this approach is even desirable.

You could simply set up a note template that creates x cards for x fields that are filled. See the chapter on card templates in the manual.

Your approach would require some finesse to create cards that have multiple equally difficult images. But it’s definitely doable.

1 Like

Used anki persistence and the card template chapter to get it worked out. Thanks for the recommendation!

1 Like