Append table2 to table3 when adding a row to table1

pmansy
New Member

Is there a way to append table2 to table3 (table2 and table3 have the same structure) when adding a row to table1? Additionally, copy the key of table1 in all rows of table2 before appending it to table3.

Example: when adding a customer to table1, also add a list of questions for the new customer with the key of the new customer to a separate table (table3). Table 2 is a template listing all the questions associated to a new customer.

Solved Solved
0 6 955
1 ACCEPTED SOLUTION

OK here is what you can do.
I just got this working on my app

Step 1

Summary

Add a column (Lets say Column name โ€œCopyKEYโ€) to to Table 2 to and enter the same unique value in all the rows
This enable you to use a select statement to get all the rows of table two

Step 2

Summary

Add an action to Table2 Called โ€œCopy This Row to Table 3โ€
Do This = "Data: add a new row to another table use values from this row
Set the columns

Table3 <โ€“Table2
Column Name = [Column Name]
etcโ€ฆ

You said all the column names are the same

Step 3

Summary

Lets assume you key column for table 2 is QuestionID (this is important)
Then back at Table1 Create a new action โ€œInitial Copyโ€
Do this: Data Execute and Action on a set of rows

Referenced table : Table2

Referenced Rows = Select(table2[QuestionID], [CopyKey] = โ€œThe value of CopyKeyโ€)

Referenced Action = โ€œCopy This Row to Table 3โ€

Now when you select initiate copy From Table one it will run the select query and receive list of every row from Table 2 and telling every row in to create a copy of itself to table three

There is probably a way to get the New UserID into Table2 first in bulk but hat is beyond what I did in my app

Anyway hope that helps!

View solution in original post

6 REPLIES 6

Is Table 2 just a Single Row of questions?

No it has about 20 rows. Each row is a question.

OK here is what you can do.
I just got this working on my app

Step 1

Summary

Add a column (Lets say Column name โ€œCopyKEYโ€) to to Table 2 to and enter the same unique value in all the rows
This enable you to use a select statement to get all the rows of table two

Step 2

Summary

Add an action to Table2 Called โ€œCopy This Row to Table 3โ€
Do This = "Data: add a new row to another table use values from this row
Set the columns

Table3 <โ€“Table2
Column Name = [Column Name]
etcโ€ฆ

You said all the column names are the same

Step 3

Summary

Lets assume you key column for table 2 is QuestionID (this is important)
Then back at Table1 Create a new action โ€œInitial Copyโ€
Do this: Data Execute and Action on a set of rows

Referenced table : Table2

Referenced Rows = Select(table2[QuestionID], [CopyKey] = โ€œThe value of CopyKeyโ€)

Referenced Action = โ€œCopy This Row to Table 3โ€

Now when you select initiate copy From Table one it will run the select query and receive list of every row from Table 2 and telling every row in to create a copy of itself to table three

There is probably a way to get the New UserID into Table2 first in bulk but hat is beyond what I did in my app

Anyway hope that helps!

pmansy
New Member

Clean, simple and it works! Thank you very much!

No problem Happy to help. I just started myself and this community has been vital for me getting my own stuff working.

Top Labels in this Space