Trouble retrieving entered data from a table component for insert query

Hi, I'm trying to insert multiple rows into the database using a table component (table_entry) in Retool.

Here’s what I’m doing:

  1. I generate empty rows in the table for user input (e.g., with null values).
  2. After the user fills in the rows, I want to retrieve the entered data and insert all rows at once.
  3. I use a temporary variable (table_data_var) initialized as an empty array to manage the data.

To debug, I added the following logs:

console.log("table", table_entry.recordUpdates);
console.log("table", table_entry.data);
console.log("var", table_data_var.value);

But here’s the problem:

  • recordUpdates returns undefined
  • table_entry.data and table_data_var.value return null or empty

So I'm not able to capture any of the entered data, and I can't proceed with the insert query.

How can I properly capture the data entered in the table so I can insert multiple rows?
Is there a better way to sync the input table with a variable or trigger the save?

Any help is appreciated!

1 Like

Hello @krsailer82 ,

I understand the issue you're facing. To retrieve the inserted values for multiple rows in an array of objects format, you should use table_entry.changesetArray. This will make it easier to insert the data into your query.

1 Like

Hey there @krsailer82,

My recommendation would be the following:

  • Within the "Interaction" advanced settings of your table, enable the "include full rows in changeset" option

  • Use table_entry.changesetArray to fetch all of the row, which will include changed and unchanged values

4 Likes

To echo what both @WidleStudioLLP and @MiguelOrtiz pointed out above, all table edits are stored in a change set and accessible with either tableName.changesetArray or tableName.changesetObject, depending on how you want it formatted.

I hope that helps! Let us know if you have any questions. :+1:

2 Likes