# TableDAT value edit / area selection

Hi I’m recently diving into DAT stuff and stucked.

I write down the values on Table DAT. (Each cell have 1 value and have indiviual range)
ex) cell [0,0] can have value betwwen 0~100 but cell [0,1] can have value between [0~200]

What I want to do is controlling the cell values placed on 1x4 Area of tableDAT by 4 sliders(or buttons)
slider1 - [0,0] slider2 - [0,1] slider3 - [0,2] slider4 - [0,3]

And move the controllerable area by buttons (up down left right) like this:
If I press up or down buttons, it will +1 or -1 the row number.
slider1 - [1,0] slider2 - [1,1] slider3 - [1,2] slider4 - [1,3]

If I press left or right buttons, it will +4 or -4 the column number.

slider1 - [0,4] slider2 - [0,5] slider3 - [0,6] slider4 - [0,7]
slider1 - [0,8] slider2 - [0,9] slider3 - [0,10] slider4 - [0,11]

Of course There are some conditions impossible to move
move left(row number go bleow 0)
move right (no value exist)
move up(column number go below 0)
move down(no value exist)

Is it possible to build this? Thanks in advance.

TABLE VALUE EDIT.toe (29.3 KB)

Hey @oxygenic,

this is a 2 part task:

• create a CHOP network to count the number of times you pressed each of the buttons where pressing “up” decrements and pressing “down” increments the a count. You can utilize the Count CHOP for this where the first input is a trigger (combining the values of buttons 1 and 4 by adding them) and the third input is the increment value so the value coming from the “up” button should be `-1` while the value coming from the “down” button is `+1`. The Count CHOP has a “Limit” parameter which can be set to `Clamp` and therefor can be clamped at `0` as a minimum and some extra large number at the maximum.

• the second part is a parameter execute script which is run when the value parameter of the Slider COMPs changes. Here you would want to read the values from the Count CHOP to determine what row and column offset you are at, determine the cell by also looking at the Slider COMP’s name digit and finally make sure that there are enough cells in the Table DAT to actually write the slider value into.

``````def onValuesChanged(changes):
table = op('table1')
# op with the row/col offset
offset = op('null_rowColOffset')
row = int(offset['row'])
col = int(offset['col'])
for c in changes:
# get slider digit to figure out which col to update
sliderId = c.par.owner.digits - 1
# get slider value
sliderValue = c.par.eval()

# set the tables size to be big enough to fit the slider value
if table.numRows < row + 1 or table.numCols < (col + 1) * 4:
table.setSize(max(row + 1, table.numRows), max((col + 1) * 4, table.numCols))
# write the value into the appropriate cell
table[row, col + sliderId] = sliderValue
return
``````

Hope this helps
Markus

Wow thanks a lot! That is absolutely resolve the problem!