Dublicating columns in table component

Hello everyone,
I'm trying to duplicate data from one column to another in a Retool table. The expected behavior is that the values from randomValue should be copied to fixedValue

1 Like

Hi @Artem_Popkov and welcome to the forum!

The way I would approach this is the following:

  • Create a variable that will have as default value your table's data source. This will allow you to edit the values of the variable in real time, which will then in turn update your table's data
  • Upon clicking the button, you will run a script which will use the setIn or setValue methods. I'm thinking something like

variable1.setValue({ ...variable1.value, random_value: x.fixed_value })

I recently made a tutorial that explains how this logic between a table and updating a variable works, here.

Hope this helps!