Associate multiple rows from one table to another using checklist?

Hi all, I’ve been trying to figure out a way to allow a user to use a checklist to associate several items to a category (see mockup below). I know how to do this manually by entering text in a Split Text Column, but I want an easy way for users to be able to do this in the app with a few taps.

Any suggestions?

1 Like

Interesting question.
I wanted also to do that without succees.
Finally i used an inline list, with an add row action when element is tapped.

Hope someone gives a solution.

1 Like

So each item can be associated with zero or more buckets?

Yes!

So this is a classic has and belongs to many association.

If designing a database to cater for this you would have 3 tables:

  1. A Buckets table: a list of all buckets
  2. An Items table: a list of all items
  3. A BucketsToItems table: a list of buckets to items associations

I’m not a Glide expert by any stretch of the imagination, but this is probably the (possibly naive?) approach I would take. The way that translates is that when you’re associating an Item to a Bucket, what you are doing is adding a row to the BucketsToItems table.

3 Likes

Interesting! I’ll look into this. Thanks for sharing!

1 Like

Getting back to your question about using checkboxes, I think you may struggle there because there is no way to dynamically add/remove checkbox components. So unless the number of items is fixed, I don’t think that will be possible.

But you could “fake” it by using an inline list and style it to look like checkboxes. Tapping an item in the list would fire an action to add a row with the correct values. I’m pretty sure that would work, I’ll see if I can make an example.

So I was able to achieve the Items belonging to multiple Buckets with this technique! However, I had to use choice list to select the item, and I could only add one item at a time.

Link to Google Sheet
Link to Demo App

However, now, the problem is:

  • I don’t know how to remove the item(s) from the buckets
  • I don’t know how to make sure only the items not yet added to the bucket are shown as options for what can be added. (Which means I could have many duplicate entries to the ItemsToBuckets sheet)
1 Like

I just managed to do it withe a choise component. But you have to add one by one with a choice component.

I think to implement your solution glide needs an iterator action that runs over all selected items and add a new row for each iteration.

1 Like

How do you keep track of the categories an item belongs to? Did you create a separate sheet like the solution described above? Or is there a different way?

Yes I use a seperated sheets where i use the row id as foreign key.

If you google for sql n:m relations you find some nice images describing that.

The tricky part is to show only the items that are left to add in the choice component.

1 Like

Cool!

So I was able to do the same technique adding one item at a time to the category (Demo App, Google Sheet ). Does the google sheet look accurate?

I ran into the problem you just mentioned though-- how to only show the items left to add. Were you able to achieve this in Glide? Also, do you have a method for removing items from a category?

I will make some Screenshots I think later today or tomorrow. Sorry party preparation time :grin:

1 Like

Haha-- Enjoy! Happy New Year! :partying_face:

1 Like

You can show only items left (still not chosen) filtering for …relation is empty

1 Like

So, in my case I have Sale Points. and Options.
A Sale point can have multiple Options for this I have the Sheet Sale Point Options.

This is the “basic” configuration. Two sale points with the options.

In the Sale Pont Sheet I have this columns:

Selected Options is a rollup to the Options I already have selected.
Possible Options is a rollup to the Options, so I can make the add new option button invisible when no more options are left.

In the Option Sheet I have this relations to check wich Option is used in wich sale point. The Joined related Sale Point column is important for the choice component filter.

This is the visibility rule for the button

This is the filter option in the choice component

And this is how it works.
choice

1 Like

It’s possible to do it whith a check list to mark several items at once
demo sheet

demo app


3 Likes

Nice

1 Like

Awesome! Thank you! Will try this out

NICE! Will try this out too. Thanks!