# Input Values of a Table--Shows correctness for more than just numbers

**URL:** <https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797>\
**Category:** Questions\
**Tags:** validation, correctness\
**Created:** [March 22, 2023, 8:03pm UTC](https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797 "2023-03-22T20:03:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phillip\_Hubbard](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/phillip_hubbard/32/4122_2.png) [@Phillip\_Hubbard](https://cl.desmos.com/u/Phillip_Hubbard)\
**Post date:** [March 22, 2023, 8:03pm UTC](https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797/1 "2023-03-22T20:03:50Z")

</div>

Hello!

I am trying to use a table to show the correctness of inputting a number, but the CL code is marking both -7 and -7x as correct. Not sure how to fix this, but here’s my code for the table:

cellContent(1,3): when table1.cellNumericValue(1,2)= 1 “✅” OTHERWISE “No”  
cellContent(2,3): when table1.cellNumericValue(2,2)= -7 “✅” OTHERWISE “No”  
cellContent(3,3): when table1.cellNumericValue(3,2)= -4 “✅” OTHERWISE “No”

correct: table1.cellNumericValue(1,2)= 1 and table1.cellNumericValue(2,2)= -7 and table1.cellNumericValue(3,2)= -4  
cellDisableEvaluation(2,2): true  
hidden: turnin.pressCount\>0

I am not sure how to adjust my coding so that only the inputted numbers are marked correct and not extra variables. thank you.

---

<div class="post-metadata">

**Author:** ![ianmcmeek](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ianmcmeek/32/3966_2.png) [@ianmcmeek](https://cl.desmos.com/u/ianmcmeek)\
**Post date:** [March 23, 2023, 2:21pm UTC](https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797/2 "2023-03-23T14:21:30Z")

</div>

Hi! One solution could be to check if the letter ‘x’ shows up in the latex of any of the cells. Here is an implementation of that based on examples from the February ('23) CL Newsletter:

> **[Checking Table Values • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/641c562084fb5f8170bfa7b7)**
>
> by Ian M

This could be easily adapted to check for multiple letters, but it would be extremely tedious to check all letters. I’m curious if anyone has ideas for another approach 🤔

---

<div class="post-metadata">

**Author:** ![Mike\_Gleeson](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/mike_gleeson/32/650_2.png) [@Mike\_Gleeson](https://cl.desmos.com/u/Mike_Gleeson)\
**Post date:** [March 23, 2023, 7:48pm UTC](https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797/3 "2023-03-23T19:48:42Z")

</div>

Just check that it’s not an expression of any type - it’s simpler and guards against any type of variable.

[Something like this works](https://teacher.desmos.com/activitybuilder/custom/641caac7e929b59c5f4bf374). I used a math input instead of a table but the same logic applies:

**correct: this.numericValue=7 and  
simpleFunction(this.latex).evaluateAt(999)=7**

---

<div class="post-metadata">

**Author:** ![Daniel\_Wekselgreene](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_wekselgreene/32/1819_2.png) [@Daniel\_Wekselgreene](https://cl.desmos.com/u/Daniel_Wekselgreene)\
**Post date:** [March 23, 2023, 10:24pm UTC](https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797/4 "2023-03-23T22:24:52Z")

</div>

I like using patterns for this. You want to check that the value entered matches with the “number” pattern, which will filter out any letters or other symbols.

> **[\[Copy of\] Checking Table Values • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/641cd0d812432b3c6c1fce61)**
>
> by Daniel Wekselgreene

---

<div class="post-metadata">

**Author:** ![Phillip\_Hubbard](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/phillip_hubbard/32/4122_2.png) [@Phillip\_Hubbard](https://cl.desmos.com/u/Phillip_Hubbard)\
**Post date:** [March 24, 2023, 5:17pm UTC](https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797/5 "2023-03-24T17:17:31Z")

</div>

Thank you for this! It worked as you mentioned. I noticed that it fixed the problem with adding an x, but students who added another variable after the number got it marked correct too. Seems like an odd feature to have that marked correct. I appreciate the help!

---

<div class="post-metadata">

**Author:** ![Phillip\_Hubbard](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/phillip_hubbard/32/4122_2.png) [@Phillip\_Hubbard](https://cl.desmos.com/u/Phillip_Hubbard)\
**Post date:** [March 24, 2023, 5:21pm UTC](https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797/6 "2023-03-24T17:21:23Z")

</div>

Thank you! I appreciate the help–this is what I needed.

---

<div class="post-metadata">

**Author:** ![Phillip\_Hubbard](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/phillip_hubbard/32/4122_2.png) [@Phillip\_Hubbard](https://cl.desmos.com/u/Phillip_Hubbard)\
**Post date:** [March 24, 2023, 5:21pm UTC](https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797/7 "2023-03-24T17:21:45Z")

</div>

Thank you for this example! I will keep this in mind.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [March 25, 2023, 7:15pm UTC](https://cl.desmos.com/t/input-values-of-a-table-shows-correctness-for-more-than-just-numbers/4797/8 "2023-03-25T19:15:43Z")

</div>

I’ve used:

```auto
 isDefined(simpleFunction(input)) and isDefined(simpleFunction(input, `y`))

```

For the first, any variable other than x used will be undefined, same if x _is_ used in the second, so any variable will be false without having to be so specific.

Also, to answer your query, it’s marked correct to allow for the use of units of some sort, so it is a feature, not a bug. 😄
