How to control inline views when many-to-many relationships are involved

I have 3 tables: Artworks, Tags, and a "Link Table". The Link Table exists because each Tag may have many artworks, and each artwork may have many tags. I created the relationships between these tables by setting a Tag Id and Artwork Id in the Link Table to ref, and then pointing each to their corresponding table. This generally works really well, except that I can't figure out how to make an Artworks detail page show tags as a deck view, while a Tag details page shows artworks as a gallery view. Here's what I mean:

Tag details looks right:

_pete__0-1717043184606.png

Artwork details does not look right:

_pete__1-1717043228488.png

I want it to look like this:

_pete__2-1717043298732.png

Which I can do by using a SELECT() function instead of REF_ROWS() in a virtual column in the Artworks table. But when I try to add a tag from the inline view using this method it takes me to the Tag form and I don't get a dropdown of possible values (like I do when I use REF_ROWS instead). In fact if I create a new row this way it's easy to create duplicate tags. Anyone know the right way for me to show tags as a deck view in my Artworks detail page. Grateful for the sage advice I always seem to receive here. 🙂

Solved Solved
0 7 391
1 ACCEPTED SOLUTION

Okay, I've tested it and I think this is the correct solution

Create the tables and the app

  • Create the following tables with the following columns
    • Items
      • Item Id
      • Image
      • Description
    • Links
      • Link Id
      • Item Id
      • Tag Id
    • Tags
      • Tag Id
      • Tag
  • Create an appsheet app from these tables (via Extensions in Google Sheets)

Set column-specific information

  • Add all three tables, and create a view for the Tags table and delete the view for the links table
  • In the data section, for the Links table…
    • Set the Item Id column is a ref column to the Items table
    • The Tag Id column is a ref column to the Tags table
  • For the Items table select the image as a label 
  • For the Tags table select the tag column as a label 

Configure the first inline view

  • For the Links_inline view, set it to deck and use the Tag Id for the primary header
  • Set the Main Image to None

Populate some data

  • Create 2-3 entries in the Items table
  • From a detail view of one of the items, use the inline Add to add some tags to the items after you have created an item

Create virtual columns & Slices

  • In the Links table create a virtual column called Linked image with this formula: [Item Id].[Image]
  • Create a slice of the Links table with no formula in it
    • Call it Gallery view slice

Create a view

  • Duplicate the Links_inline view
    • Choose the Gallery view slice for this data
    • Set the view to gallery

Create one more virtual column

  • In the Tags table, add a virtual column
    • Name it Related items
    • Use this formula: REF_ROWS("Gallery view slice", "Tag Id")
    • Turn off (deselect show checkbox for) Related Link tables
  • Voila

View solution in original post

7 REPLIES 7
Top Labels in this Space