Using multiple files with data tables

I’ve used this clone for the upload server code and added the click function to an existing, create record function.

I have one main record, and a multiple linked row to an images table, how do I update the linked row with all the linked rows from the images table. Is there a tutorial somewhere to do that part of it.

Thanks in advance

I’d recommend using Search for that.

Since you want to make a coordinated set of changes, across multiple records (in this case, in multiple tables), also see Transactions, in the documentation.

With transactions, if trouble occurs between one record update and the next, the previous “partial updates” get automatically cleaned up, as if they had never happened. This is a lot easier to deal with than having to detect the situation later, in your own code, and clean it up yourself.

Would you put them in dicts then and do a transaction? So I could do an append on the images to create the image dict then the other one only has one record is just a single dict.

I just had a big thread on a policy transaction that updated 3 tables, on that I used a counter table to get the next number, created a reference through that, that was used as a reference on all the tables.

So, in theory could I do a similar thing, i.e create the main record and give it a reference, then update all the images with that reference number, then linked the two?

That sounds very workable. I recommend putting all of the database-specific steps (adds/updates) in a single transaction.

1 Like

Thanks, will give that a go!