Append table2 to table3 when adding a row to table1

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.

1 Like

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!

2 Likes

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

1 Like

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

1 Like