Checking Correctness of Table Entries

I am hoping someone can help me fix my code in order to have a student’s table value entries show up as correct (with a checkmark) on the teacher dashboard. I have managed to do this for all of my multiple choice questions, however I would also like to do it for the numerical values the students enter into a table.

Here is my attempted code:

figure1number = table1.cellNumericValue(1,1)
figure2number = table1.cellNumericValue(1,2)
figure3number = table1.cellNumericValue(1,3)

correct = when (figure1number =15)
and (figure2number = 17)
and (figure3number = 19)
otherwise 0

Thank you in advance for your help!

1 Like

Your conditional for correct doesn’t have a result for the when part. If you want it to be a Boolean, get rid of the when and otherwise 0.


Thank you for your response. This did fix my code, however it still does not show the checkmark in the dashboard if the table entries are correct. Is this possible? Currently it only shows a “dot” to mark that a response has been inputed, but not checkmark or “x” to denote an incorrect entry.

If you know of any work arounds for this please let me know. I apologize in advance, this is my first time using these measures.


1 Like

I’m not well versed in that, but I’ve seen posts that certain things should be marked as read only, like graphs or (if you require a student to explain an answer) an explanation.

I having trouble with my code on slide 6 of this activity I’ve created, I want students to write in factored form in the first column but when I use parentheses, the code will not register as the correct answer. I’m stuck with Row 3 of my table. Any suggestions on how to fix it?

1 Like

I think it has something to do with the parentheses. I changed it to latex form and it worked:

cellContent(3,3):  when table6.cellContent(3,1)="2\\left(3a-b\\right)"

You might want to put a warning in the note to make sure the students don’t put any extra spaces in the expressions. If they do, all these will get marked wrong. Checking latex can be a bit tricky. There are other methods, but you might not have time to change the code (depending on when you need to roll this out).

Thanks so much for the help!

Is there a better method I should use in the future?

I usually use simpleFunction with evaluateAt and some countNumberUsage. Here’s what I came up with for the particular row you asked about earlier:

cellContent(3,3):  when simpleFunction(table6.cellContent(3,1), "a", "b").evaluateAt(5,6)=18 and countNumberUsage(table6.cellContent(3,1), 2)=1 and countNumberUsage(table6.cellContent(3,1), 3)=1 and countNumberUsage(table6.cellContent(3,1))=2 "✅"
otherwise " "

For the evaluateAt(5,6), that means that if you take the expression that’s typed in the cell, 5 will be substituted for a and 6 will be substituted for b. I just randomly picked 5 and 6, so anything could go there (except don’t choose 1 or 0 because their properties could yield false positives). The countNumberUsages are looking for one 2, one 3, and only two numbers total in the expression. Also, we defined the variables in simpleFunction, so no other variables would be accepted.

Is this activity from IM? It looks familiar…

Thanks for the help, this gives me a good idea how to do this in the future!

Hi cwinske,

You helped me out a couple weeks ago, simplifying my code and I was wondering if you could help me with the the code in slide 1

Thanks in advance,


You bet. In the sketch, type this: readOnly: true.

For this input, try this:

correct = firstDefinedValue(this.numericValue=80)

correct: correct

suffix: "degrees"

This allows for a label but also will ignore if a student attempts to type “degrees.” I would try to avoid checking latex because extra spaces will automatically cause the problem to be incorrect.

Thanks so much!!!

If you don’t mind me asking… to avoid using latex, how would you go about coding for question 3 (slide 3)?

You’ve so helpful!

You’re welcome! I would use parseEquation for that one. Add this to the input (don’t forget to mark the sketch as readOnly):

correct = parseEquation(this.latex).differenceFunction("w").evaluateAt(52)=0

correct: correct

The parseEquation reads the latex as an equation and the difference function subtracts the left side and the right side of the equation. Since there should be a “w” variable, if we substitute 52, the difference should be 0. This will allow for different iterations of the equation too i.e. w+w+76=180.

You could also toss in an errorMessage to make sure the correct variable is being used. This goes in the input too.

ev1 = simpleFunction(parseEquation(this.latex).lhs, "w").evaluateAt(52)
ev2 = simpleFunction(parseEquation(this.latex).rhs, "w").evaluateAt(52)

errorMessage: when isUndefined(ev1) or isUndefined(ev2) "Only use the w variable" otherwise ""

Could you alternatively have a variable for the differenceFunction, then use that for both the correctness check and for the undefined check?


correct: d=0
errorMessage: when isUndefined(d) "Only use the w variable" otherwise""

I was trying to do something like that, but couldn’t get it to work. That looks like it should do the trick.

You’re AMAZING!!!

Do you ever put on any clinics or is there a book that has all these commands and what they do? How did you learn all this? I really enjoy creating these activities and want to learn more.

I have one last question for now… how about code to check an expression?

I learned from @Jay! I started by doing the CL scavenger hunt and then just kept learning by making activities. There are webinars that @jay has hosted that are archived somewhere in this forum.

For your question, don’t forget to mark the sketch as readOnly: true. For the input, try this:

correct = simpleFunction(this.latex, "a", "b").evaluateAt(5,5)=5 and countNumberUsage(this.latex,2)=1 and countNumberUsage(this.latex,3)=1 and countNumberUsage(this.latex)=2

For the evaluateAt, I just chose to sub 5 for a and b, which happens to evaluate to 5. You can pick other numbers too. I also look for one 3, one 2 (countNumberUsage only looks for positive values), and two numbers total.

The @Jay’s webinars are in the Announcements section, but here’s all 5:

1 Like

Yep! We’re also running clinics by appointment:

And hosting webinars daily:

(for a limited time)


I have quick follow up for you about this code for checking an equations most of my students wrote down the correct equations which was 2x+76=180, but I had a kid write w=52, which is technical correct but I was hoping to have it in a form “something” = 180 (or 180 = “something”) Do you have any suggestions on how to get it in that format?