# Checking a table with a variable in an answer

I am new to CL and I am starting teach my 7th graders how to write equations and expressions. I am creating a table that checks for correctness but it doesn’t allow me to put 100x in as a correct answer. How do I get it to check an answer with a variable?

cellContent(2,3): when table1.cellNumericValue(2,2)=94 “ ” otherwise “ cellContent(3,3): when table1.cellNumericValue(3,2)=167 “ ” otherwise “ cellContent(4,3): when table1.cellNumericValue(4,2)=5724 “ ” otherwise “ cellContent(5,3): when table1.cellNumericValue(5,2)=100x “ ” otherwise “ 100x is not a numeric value; it’s an expression so it results in NaN. You can make a function instead and evaluate at a few values. (Using cellSuffix looks a little nicer instead of a whole column for feedback. Gives a little more real estate for the other columns too. Also, you can use `this` for the component you’re in instead of the name.)

``````f=simpleFunction(`this.cellContent(5,2)`)
cellSuffix(5,2): when f.evaluateAt(1)=100 and f.evaluateAt(3).300 "✔️" otherwise "❌"
``````

You could change the last to be table1.cellContent(5,2)=“100x” and that should do the trick!

They don’t recommend comparing text. That will work better if you use backticks instead of quotes, since latex will get rid of extra spaces. But they generally recommend evaluating and not comparing latex, which can be fragile at times.

The issue I’ve found with using simpleFunction is that it will also accept y=100x. Is there a different way for it to only take the expression?

I used simpleFunction for a piecewise function application activity where students had to write an expression for each piece in the math box and then their expression, as long as it was correct, populated onto another screen. The other screen put the “parts” together to write the piecewise function. What I didn’t anticipate is some students were writing y=expression and it was accepted as correct. Then, the y= part also translated to the other screen which was confusing. I hadn’t ever considered that issue, but maybe `isUndefined(xyLine(\${input.latex}).slope)` (would only work for linear answers) or `isUndefined(simpleFunction(parseEquation(\${input.latex}).lhs,"y").evaluateAt(0))`
I’m not sure how `parseEquation` handles expressions.