I am really new to retool and having some trouble updating multiple records based on the user selecting multiple rows in a table.
I have created a table that displays data from my database and have successfully updated 1 row. I would like to be able to update multiple rows but unsure how to set this in the GUI Mode.
I've enabled multiple rows to be selected in the table but not sure how to reference this in the IN clause.
You can hover on the {{}} code to view what kind of data you are passing as argument in the GUI filter. You can also open the left panel (CMD+B) to view the data structure of your components and resources so you would know how to properly refer to them. Some screenshots on your table structure would be helpful to pinpoint on how you are accessing the array of ID.
I'm assuming you are using a Google Sheet Resource here, might want to check up on how to bulk update it. With the resource you are using now, it seems it will update all the specified ID by the single value you place and not dynamically update the value for each ID. If this is your use-case, then it should be fine.
When I enable multiple rows and I hover over the resource I get 'undefined' Is there a different way of selecting the data when multiple rows are selected?
I see. You can hover on the TransactionTable.selectedRow.data and it'll show you that it has a structure of Array<object>. What you want is to iterate over TransactionTable.selectedRow.data to provide you a list of ID. You can do either of the following:
That error code is an Oracle DB specific error. It's basically saying that's the wrong syntax. I'm not familiar with Oracle DB so you might want to read up on their documentation re: Working with Arrays.
Something I find similar is the Postgres syntax on this cheatsheet. You might want to try that syntax if that works for Oracle DB.
Hi,
I have the same question, but for some reason, the solution @jocen suggests does not work for me.
I have a table (new table component) and want to add a timestamp to all selected rows. I'm trying to use this code: {{ formatDataAsObject(emailDuplicatesTable.selectedRow).id }}
I do not use .data to access tables selected rows based on the documentation provided for the new table component, but I've tried to do this with .data as well.
Am I missing something here? Could there be an issue with the code or my understanding of how to access the selected rows? Any guidance or suggestions would be greatly appreciated.
I'm not sure does that work, because I only want to add a timestamp to the column manually_deleted for the rows that are selected. Users do not edit any rows manually.
I see that the problem that I mentioned before was because I was using .selectedRow and not .selectedRows.
I fixed this, but now I get null value rows for some reason even if there are no empty rows in my table. Why these rows are being shown?
I see because you have empty values in the table.... I think you would need to transform the changeSetArray to remove the empty values and then use the new value in that query