How can I update a table by a Custom Column Value?

Hi, I can't figure out how to update a table based on a custom column value (no matter if I tried the bulk update or the update based on the action button). The custom column is not a column in my main database.

In the screenshot below, I have data from the main database. I need to value in column Parameter Type (e.g. value "tbd") to change based on a value column Set Parameter Type (e.g. value "color"). I can't find a way to get the value from the custom column.

Here is my query:

UPDATE parameter_library
	SET
		parameter_type_id = 'what to put here?' 
WHERE
  	parameter_type_id = {{parameter_type_table.selectedRow.data.id}}

Any ideas? Thanks for the help!

Try checking out the "changeSet" property of the table. You can find a value for each row where you've set a value.

You can access the value you need with:

parameter_type_table.changeSet[parameter_type_table.selectedRow.index]

1 Like

@MarkR Hi Mark, it works! Thanks for the help!

Finally, I don't use the Custom Column but a dropdown based on the original column. Still, I had a problem getting the changed value into the query. The proposed solution work for both cases.

Here is the final query if it helps someone:

UPDATE parameter_library
	SET
		parameter_type_id = {{parameter_type_table.changeSet[parameter_type_table.selectedRow.index]['New Parameter Type']}}
  WHERE
  	id = {{parameter_type_table.selectedRow.data.id}}

And the current state of table.

1 Like