New to Appsheet so forgive if this is a rooki...

(Doug Armand) #1

New to Appsheet so forgive if this is a rookie mistake

I am trying to relate two google tabs by using REF in a sort of one to many relationship.

Seems to work except the related inline form with the related records displays just one item even though the (View) count shows the correct number of related items.

Clicking on the (View) link opens a new view with still just 1 item showing?

(Steven Coile) #2

How have you implemented your “sort of one to many relationship”?

My guess would be your Imagery table (or slice) has six records, all with the same KEY column value.

(Doug Armand) #3

+Steve Coile Hi thx for replying.

I have 2 tabs on same sheet - Imagery and Sales.

Both have the same column name with the same data type - text.

Imagery is the master and the column has only unique keys. The sales obviously is the many and so no unique keys.

I placed the REF formula in the Sales table - so the Imagery table has the related LIST - not sure if that is how to do a one to many in appsheet?

(Steven Coile) #4

@Doug_Armand All tables must have unique keys in order to work properly, so you’ll need to give each row in Sales a unique key, even if it means adding a new column to the Sales sheet/table.

I’m guessing your app is an attempt to track sales of images. The Images table records the individual images, and the Sales tables records sales and the image sold with each sale. If so…

Each image in Images is a distinct record, and should have a unique KEY column value.

Each sale in Sales is also a distinct record, and should also have a unique KEY column value. Each sale record in Sales should also have a Ref-type column that references the row in the Images table that describes the image sold. The value in that Ref column will be the KEY column value in the Images table for the image.

(Doug Armand) #5

Many thx for that concise reply. I was trying to be too clever and had set both columns as the key. Leaving the master set as key and then letting appsheet use the _rownumber for the many has sorted it. Thx again -

appreciate it

(Praveen Seshadri (AppSheet)) #6

@Doug_Armand, in general, don’t use _RowNumber as a key. It isn’t a stable way to do it. Try to find or add a column that uniquely identifies a row. You can, for example, add an Id column (of type Text) and give it the expression UNIQUEID() as its InitialValue. If you make that the key, it will be fine.

(Doug Armand) #7

@praveen Thx for the heads up. Have now added a column that will have a unique key for the many (Sales) table. Very quick responses on this forum - much appreciated