Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Copy multiple rows from template table to child table for a parent record (template scenario)

I have a template scenario where a list of tasks are maintained in the template table by an admin and can change (add/remove tasks) as needed.  When an operator creates a work record (in the parent table),  I'll need the system to copy the rows from the template table into the parent's child table.

I currently have a grouped set of 20 actions configured to copy over exactly 20 tasks but it appears the client will need more flexibility in the number of tasks (rows) that will need to be copied over.

I've used templated info before in a single-user environment where I was able to set a field in the template table to the parent table id and then copied the row over to the child table (with the parent _id in tow to make the connection) but I'm not sure how this would work in an active multi-user environment where many employees are running the same function concurrently.

I've read through a few scenarios here but couldn't find my scenario. Would be grateful for any ideas. Thanks so much!

Solved Solved
0 5 383
1 ACCEPTED SOLUTION

I currently have a grouped set of 20 actions


🤢😵

 

  1. flag the parent record by setting a lookup-able value in it somewhere, like a timestamp lookup-able via MAXROW, or the user's email, or both. (depending how you do it, maybe need to clear this value after you're done)
  2. create a single add new row action on the template table that copies the record along with the looked-up parent id
  3. run #2 from a reference action ("execute action on set of rows") on the parent, across all template records.

View solution in original post

5 REPLIES 5

I currently have a grouped set of 20 actions


🤢😵

 

  1. flag the parent record by setting a lookup-able value in it somewhere, like a timestamp lookup-able via MAXROW, or the user's email, or both. (depending how you do it, maybe need to clear this value after you're done)
  2. create a single add new row action on the template table that copies the record along with the looked-up parent id
  3. run #2 from a reference action ("execute action on set of rows") on the parent, across all template records.

Thanks Marc - yes that "lookup-able" id is the challenge since the parent record isn't saved to the table quickly enough to reference it in the single add row action.  Have you had any luck with the Dynamic Input() - would be great to use this with some confidence. Still shows it's in beta

 

Isn't saved quickly enough? There should not be any issue there.

Unfortunately you can't use INPUT() when adding new records. It's just not supported (yet?). Though I do use INPUT() in lots of production apps, regardless of its supposed beta status. It's a game changer that you should definitely look into more.

Hi Marc, I tried the scenario you mentioned and the "lookup-able" id I was referencing for the parent_id showed up as NULL in my child table.  I'll try it again...thanks

Hi Marc, thanks for the support. I went with creating my own parent_id (vs. UNIQUEID) with data I have available in USERSETTINGS(employee_id) and a timestamp so that I can call on that data for the child records as needed. There are hours between parent record entries so it's pretty safe.

Again a million thanks for the trigger on ideas😊

Top Labels in this Space