Manually updating changesetArray for bulk updates

I have a table with an editable column and I'd like to push bulk updates across multiple rows. I can't seem to find a way to set changesetArray with new values from a javascript query. Does anybody have an idea how to do this?

Hi Eric,

Are you trying something like this after a change?

Yes, sort of? I want to manually add new objects in bulk to the changesetArray. let's say I have a column called "activated". And let's say I have another data source that would allow me to update that column in the table and let the user preview it before applying the changeset.

I would want to say table1.changesetArray = newChangesetArray

I don't get it exactly, but in the query, you can use Object.assign()

const target = { a: 1, b: 2 };
const source = { b: 4, c: 5 };

const returnedTarget = Object.assign(target, source);

console.log(target);
// Expected output: Object { a: 1, b: 4, c: 5 }

console.log(returnedTarget === target);
// Expected output: true

AFAIK, you cannot alter the changesetArray at all (there is no public set function for this property).

You would have to transform and return the whole set of data and use the results for your review table and then use that table to drive the bulk updates.

Yeah, this is what I suspected. There's no "set" function for the changesetArray. I guess I would have to write some kind of query or transformer to sit inbetween the database and the table. it would be nice to be able to update the changeset and then "save" those changes.

1 Like

I am with you. Updating the changeSet programmatically instead of updating the table source and reloading (which can be "expensive") has been requested a few times before but there is no clue if this has ever made it to the roadmap or not.
If a Retooler could chime in...

Hello @Eric_McGregor , @yiga2 ,

There is currently no way to update the changeSetArray programmatically built in Retool. I have gone ahead and created a Feature Request in our logs as I can see the value as well.

-Brett

2 Likes

My use case is to give the user a preview

for example, i have a function that copies data from a table and user can paste it to another, so my idea is to set the copied data as a ChangesetArray, that way the user can preview the changes that will be made