Update a Table DAT via Script DAT from within a Replicator COMP Item -> td.tdError: The operator is not editable

Hello everyone
I am still relatively inexperienced with TD.

I am using a replicator COMP to execute the network inside the master operator container COMP for each row in the table “replicatorTable” DAT. I have created a duplicate of the “replicatorTable” with the name “resultTable” and inserted a column with the name “treshold”.

Within the master operator container COMP, I determine if the current row fulfils a certain condition that results in a value of 1 or 0. I have already set up the network to check the conditions using the standard OP. So I get a value of 1 or 0 in either a CHOP (“null3”) or a DAT (“null4”) format.

Now I want to write the resulting values back to the corresponding row in the “Threshold” column in the “resultTable” DAT table one level higher.

I have used a script DAT with the following code. according to the print() seems to work for the most part. however, I get the following error message:

“Traceback (most recent call last):
File “/project1/container1/script1_callbacks”, line 37, in onCook
td.tdError: The operator is not editable.”

Here is my script. The toe-file is attached.

def onCook(scriptOp):

	condition_result = op('null3')[0].eval()
	# Use the digit of the current replicated item to identify the row
	row_index = me.parent().digits
	# Access the parent to get the resultTable DAT
	resultTable = parent().op('../resultTable')
	print(resultTable)  # This should print the operator reference, not "None"
	# column_name
	column_name = 'treshold'
	# Ensure the row_index is within the valid range and correct for zero-based indexing if needed
	if 0 <= row_index < len(resultTable.rows()):  # Adjusted comparison to include 0
   	 op(resultTable)[row_index, column_name] = str(condition_result)  # Directly use the column name

3dGrid_wip12.1.toe (12.0 KB)

Hi @palmavilluan,

in the context of the DAT family, you can only write to Text, Table, and FIFO DATs - all other operators do not allow for writing to them and any attempt will result in the error you are seeing.

For you specific case, I would suggest just using a Merge DAT to fetch all the DATs from inside the replicants (you can use wildcards, so something like _project1_container*/null_value will work) and then append the column again with a Merge DAT to the original table. No scripting required that way.

A note: careful with the operator prefix in your Replicator. As you are using the path of an operator which includes digits itself, the numbering of the resulting replicants is not consitent with the index column in the replicator table. Better to use a descriptive name - for example base_hue and use the “index” column as the “Name from Table”, Column by Name - “Column Name” source. This way you can rely on the index of the primitive as the id even if those get reordered. The expression in your Chroma Key TOP would then also have to change slightly - currently it is looking at a row number (via the parent digit) while now you would want to be looking at the row header for which the parent digit needs to be interpreted as a string: op('../replicatorTable')[str(parent().digits), 'Hue']


well thank you alot for your fast and helpful response! that indeed seems to work;)