Workaround to Using Variable for Multiple Choice choiceContent source for Note CL

I was trying to make a note whose content is dependent upon which choice a student chose from a multiple choice, but I get the error that choiceContent’s parameter must be a constant. Is there a workaround that doesn’t require making a separate “when” statement for each isSelected() choice?

n=
when qq5b.isSelected(1) 1
when qq5b.isSelected(2) 2
when qq5b.isSelected(3) 3
when qq5b.isSelected(4) 4
otherwise 0

content:
when qq5b.matchesKey "Great job! The pattern is ${qq5b.choiceContent(4)} ✅"

when qq5b.isSelected(1) or qq5b.isSelected(2) or qq5b.isSelected(3) "Try again. The pattern is not ${qq5b.choiceContent(n)} ❌"

otherwise "So, the pattern is `y=`"

I don’t think there’s a way of using choiceContent like that, but since you have the whens set up anyway at the start, I would modify to:

n=
when qq5b.isSelected(1) qq5b.choiceContent(1)
when qq5b.isSelected(2) qq5b.choiceContent(2)
when qq5b.isSelected(3) qq5b.choiceContent(3)
when qq5b.isSelected(4) qq5b.choiceContent(4)
otherwise ""

then you can just have:

content:
when qq5b.matchesKey "Great job! The pattern is ${n} ✅"

when qq5b.isSelected(1) or qq5b.isSelected(2) or qq5b.isSelected(3) "Try again. The pattern is not ${n} ❌"

otherwise "So, the pattern is `y=`"