Update based on selectedRow id?

update files set show = NOT show where id in ({{ filesTable.selectedRow.data.map(row => row.id).join(',')}})

I thought it should be something like this, but it can't work?

Can you elaborate a bit on what you're trying to achieve?

i m trying to run a SQL update to list of records that I select through tables.

Hey @knight! Are you editing these rows in your table and hoping to update them in your DB?

If so, I think table.recordUpdates would work perfectly for your use case. Instead of having to loop through the selectedRow.data.

Please reference our docs on bulk updating here: https://docs.retool.com/docs/working-with-tables#editing-table-values-making-data-editable

Nope. I want to select multiple rows and click on toggle button and all these records get updated.

My transformer where parse the selected row and return id, you can see I try both, either return as array or return as a join string.

My query where I try to update with the above transformer

Hi @knight This section in our docs shows how to reference an array in a Postgres query. Would that be helpful here? You'd have to remove .join(",") from your transformer

weird, i been trying that without luck, but it's work now. thanks

1 Like