Saving a collection of records into a variable, and retrieving to save into a table

Hello, I’m looking to create a rest call that would accept a couple parameters (user, olddate, newdate) and copy old records in one table and save them in a new table with a future date. I can call the records but I think I’m stuck on how to properly save them so that I can store them in another table. Any suggestions?
Your help is much appreciated.
tks
Here is an embarrassing example of what I’ve tried:

Hello @Joel_Maclean

Perhaps the error occurs because loadData is not defined as an object

With my correction it should work fine
Make sure that the “workoutstatsdetail” table has same columns as the “workoutmasterdetail”

But I would recommend you to simplify this like:

Please note that “Bulk Create” does not overwrite existing objects with the same values (with the exception of objectID), but creates new ones.
And for Load Table objects - properties, use array of columns names. The string with several columns names will not be supported soon

Regard, Viktor

@viktor.liablin thank you that worked!

I used your simplified suggestion and it was perfect, however I need to change some values in the array before saving it to the secondary table. So I have saved the data to a variable (loadData) and I can then save it from the variable back to the table. However how would I set a property on all records to a specific value?
In this example I have 10 records, but I would like to change the property ‘user’ on all records from USER A to USER B.
Suggestions?
Thank you for your help

Hello @Joel_Maclean

You can iterate over your objects, and change what you need. Below I show a little example, where I have two tables(‘one’, ‘two’) and want to save objects from first to second with adding ‘123’ to property ‘name’.

Regards, Dima.

Thats it Dima! You got it. Thank you so much :smiley: