Update Value in Variable when update a cell on a row in table

My Main gold is to Create a task / request form using table.
Temporary save registered data in the table to a variable "ItemsRows".

When user has registered all items in the table user can press "Send Request" this will then save all data from variable "ItemsRows" to my MySQL DB using a Insert query.

I have a button that adds empty row to my table / variable ItemsRows with a PrimaryKey, Row number, and due date.

I need some help with updating variable ItemsRows when user register information in the table.

I get output error: Unexpacted token '{'

The script I have that do not work is :

// Function to update Description in ItemsRows based on row index
function updateDescription(rowIdx, newDescription) {
    let items = [...ItemsRows.value]; // Create a copy of the ItemsRows array
    if (rowIdx >= 0 && rowIdx < items.length) {
        // Update the Description field in the specific row
        items[rowIdx].Description = newDescription;
        ItemsRows.setValue(items); // Update ItemsRows with the modified array

// Event handler for Description field change
function handleDescriptionChange(rowIdx, newDescription) {
    updateDescription(rowIdx, newDescription); // Call updateDescription function
    return ItemsRows.value; // Return the updated array (optional, but good practice)

// Assuming you have the row index and new description passed as parameters to the query
const rowIdx = {{self.rowIndex}};
const newDescription = {{self.Description}};
handleDescriptionChange(rowIdx, newDescription);

Is there some error in the code?

Note I have no knowledge about Javascript. so I need how to solve this for dummys.

Hope that there are somebody that will take the time to help me.

Hello, can you send a screenshot of where you are using it? the last consts might be incorrect. Also, ItemsRows has to be defined correctly or it can make it fail

Hi @GuilhermeSilva

My table name is Items
DataSource is ItemsRows
ItemsRows Variable settings:
Example of ItemsRows state after adding empty rows:

On the the column description I have a Event handler.

on cell change it triggers to run the code.

If you have another code / way that I can update my variable with information registered in my table.

In advance thank you.

In my opinion the best way to solve this is to make the table rows editable and then configure the event handler to run the insert query with the data (table1.changeSetArray)
Can you try that? if you can't get it to work I'll help with the code, but it should be the simplest solution