Attach a child table to a record of another table

I would like to create a child table that is owned by a record of a parent table such that for each record of the parent table it has it’s own copy of the data in the child table. For example let’s say I have a Game table. Each row (record) of the Game table represents an instance of a game with the game parameters in the record. Each game record also needs a points table that can be edited for each Game record. For example:
Offset Points
-4 6
-3 5
-2 4
-1 3
0 2
1 1
2 0
3 0
ect.

How would you go about implementing this behavior in Appsheet?

Thanks,
Steve

You’re speaking in reference terms, but are you aware you can connect tables together with reference in AppSheet?

1 Like

Yes I know about references. I know a row in one table can reference (and own using “is part of”) a row in another table but I want a row to own another table so that when a row is added in another table it creates another copy of the table it references. It’s almost like a 3D table. Is this possible somehow?

Steve

So you want to copy data from one table to another; you’ll end up with copies of copies of copies…Such data-duplication is a bad idea.

1 Like

Rosebud:

Is this possible somehow?

Yes.

No, I don’t want to copy data. I want to have a row in one table that owns an instance of another table with different data.

Here is the structure I want
Col 1 Col 2 Col 3 Col 4
Row 1: val1 val2 -4 5
-3 4
-2 3

Row 2: val1 val2 -2 4
-1 2
0 0

So Table 1 has the rows Row1 and Row 2. I was thinking that Col 3 and Col 4 could be a separate table and could be edited along with each row added.

I suppose I could create child rows but I would need about 15 child rows per row added. It seems cumbersome.

Steve

How?

The app itself cannot create tables; the app editor must be used to create tables. To have something akin to a new table, you’d have to use slices, security filters, and/or partitions to display data in an existing combined table as a distinct table.

Rows of one table do not “own” rows of any table. Your use of this term is confusing.

Your examples aren’t clear.

Can you give us a concrete idea of what your app is for? And why you need these tables of tables?

2 Likes

Let me explain a little better. I have 2 tables. Table 1 is a table of game parameters in which each record represents a game being played. I have another table (Table 2) of weighting points which are used for every game being played which looks like the following:

Offset Points
-4 6
-3 5
-2 4
-1 3
0 2
1 1
2 0
3 0

The problem is that I want to have each game being played (Table 1 record) to have it’s own set of weighting points (Table 2) that can be set when a new game is added in Table 1. Currently, all games being played have to access the same table of points (Table 2). So, if one game changes the points table they get changed for all games being played. This is not the behavior that I want. I want to have each game (a record in Table 1) to have it’s own set of weighting points.

1 Like

Table 2 would need an additional column to store the game (a Ref to the row in table 1) with which each row of table 2 is associated. When you need a row from a particular game’s set of table 2 rows, you would need to look only at those table 2 rows that reference the appropriate game in table 1. In effect, the rows of table 2 would be “child” rows to the “parent” row in table 1. This is what @MultiTech_Visions was getting at with his help doc suggestion, above. You could use slices to make is easier to focus on only one game’s set of table 2 rows.

The next challenge is automatically creating the set of rows in table 2 for each (new) row in table 1. These posts might provide some guidance:

[FAQ: add a set of rows](https://community.appsheet.com/t/faq-add-a-set-of-rows/30846) Tips & Tricks ?

When a row is added to a table, add a set of rows to another table. Try the sample app! This example uses three tables: Master Table: when a new row is added here, all rows from Source Table will be copied to Target Table and linked back to the new Master Table row. This table must allow adds. Source Table, from which all rows will be copied to Target Table. Target Table, to which all rows from Source Table will be copied. This table must allow adds. Action 1: Copy Source Table row…

[FAQ: Add a number of rows](https://community.appsheet.com/t/faq-add-a-number-of-rows/30503) Tips & Tricks ?

Add an arbitrary number of rows to a table based on a column value of type Number. Try the sample app! For this example, the table from which the row-addition process will be initiated is called Control Table. The table to which new rows will be added is called Target Table. Use your own names as you see fit. Note that they could even be the same table. Control Table must allow updates; Target Table must allow adds. Control Table must have at least two columns for this process: Finish Count (…

1 Like

Thanks Steve!!! The first example worked great. I appreciate your quick response!

Steve

1 Like