Students can add rows to a table and can add content to each cell in the table.
Let’s say that I wanted to make a list and print out something like “The values you entered are {cell1}, {cell2}, … and ${last_cell}”
I’m having trouble finding something that lets me do this when I don’t know the size of the table in advance.
My current workaround plan is to fix the table at a length of 10 and take any non-empty cells, but I would like to be able to get a source of the number of rows / number of columns when students are allowed to add rows/columns.
Any advice?
maxRows
Sets the number of rows the table will display.
If it is just numeric values that are being entered into the cells, you could probably do this with columnNumericValues, which turns the values into a list that you could then process further in a graph component or within the CL. For instance, length = this.columnNumericValues(2).length should give you the number of values in the second column, or in a graph component something like numberList("X"): table1.columnNumericValues(2) would inject the table column as a list in the graph for further processing.
Here’s my version. I’m using the hidden graph to sort out undefined cells (for when a student goes back a deletes an entry). Note that these are the decimal numeric values of the cells, NOT the actual cell entry. I then have some conditional statements for the text in the note. Let me know if you have questions about some of the use of ${} in the text.
I’ve got it working with number-only expressions. You could do it with text, but it’ll get fairly complex because you’ll have to define individual evaluated simpleFunctions with all letters as variables.