Update Query using ChangesetArray trying to update identity column

Brand new to this app. Built a test table to get a feel for the actions.
trying to update a row, but the query is trying to update my identity column.

SQL Server
The identity column is set on the table.

1 Like

RetoolTestId should be the table row selected - though not sure how you are editing the table row(s) - also have you set a primary key for the Retool table component?

I've tried it with that: see newly attached and yes also attached


image

and I'm editing by row currently. once I get this working I will look into editing by form

If that id field is a primary key you wont be able to change it in the db even though you allow it in the Retool table

I'm not trying to change it. I want to change any other field I happen to be editing.

Hello @Shegs,
As @ScottR 's explain, you can't change primary key. First you have to trim id from changesetArray.

You can do it by lodash's omit function. Just like that.

{{ _.omit(testTable.changesetArray[0], 'RetoolTestID') }}

I will give that a try, it didn't seem like it was in any documentation for using changeset array.

Quick question, why is it (recordID) showing up in the changeset array when it's not being modified in the row?

When you use Update an existing record as Action type, it only asks you to provide the columns you will change. But if you are going to bulk update you need to give an array containing the key.

The queries run in the two cases will be different from each other.

ah I see, I just had the wrong action type selected.

1 Like