Can't copy table (and parent table) to another table changing IDs.

Hello everyone, 

I have two connected tables as follows:

Table one: ID_table1, Date_t1

Table two: ID_table2, ID_table1, Date_t2, x, y, z

In table 1 i also have a column with ref_rows from table2.

I would like to make an action or automation to copy this tables to other tables (same columns) but i need to change IDs because they must stay unique. While doing this, while setting up new IDs, i still need to keep the references through the tables. I also need to give the user the possibility to change the date. 

To sum up, i need a way to copy two related tables to two more tables while changing dates and IDs and keeping references. 

I tried to use actions and automation but it seems quite difficult, maybe would be better to use Appscript?

NOTE: Records to table 1 are added via automation when adding records to table 2. If i use Actions/Automation/Appscript to copy rows between table, will the first automation still start? In this way i would have more data than i need. 

Thank you very much

 

Solved Solved
0 10 439
1 ACCEPTED SOLUTION

Let's assume the following tables:

Schedule Template:

id Day Employee ...
1 x a ...
2 y b ...

Week:

id year week
202301 2023 01
202302 2023 02

Weekly_Shift

id Week (Ref) Day Employee Date ...
ghj489 202301 x a formula from week & day ...
pyt873 202301 y b   ...

The creation of a new Week record can drive the copying of all schedule template records into the weekly_shift table, referenced to the just-created week record. Use a reference action to do so.

I don't understand why your main question seems to be about the id values. Just use UNIQUEID() for the id column of weekly_shift. Not really sure what your other questions may be here.

View solution in original post

10 REPLIES 10
Top Labels in this Space