Adding and Deleting Tags from a Related Table

I have been struggling with this for over an hour and it’s time to get some help!

  1. I want to display a list/map of locations and allow users to filter them by at least one tag
  2. I would like users to be able to add a place and associate the place with one or more tags from a predefined list.

I started by creating a table with the Place ID and Tag and used this for filtering. But I could not figure out how to enable users to add tags to this data structure when adding a new place. Multiple select would not work for this case.

I tried some other hacks to enable users to enter one or more tags (like checkboxes) but I could not figure out a way to manipulate the data to make it useful for display filtering.

Does anyone have any ideas? I can provide more info and screen shots if this does not make sense.

pete

Hey @Mauronic!

Can you plz?

1 Like

Sure! I created a test project and was able to solve some problems.

  • View places and filter by tags - for example parks with restrooms
  • Edit a place to delete a tag (albeit cumbersome)

However, adding a tag to a place currently allows duplicates. Do you know how I could address that?

Here’s a sample project:

And here are what the tables look like:

image

image

image

As far as not allowing duplicates, I think @Robert_Petitto’s example may help, but after experimenting with this for an hour or so I am not sure how I would modify it for this case.

If it’s just a predefined list of tags, would it be easier to create a column for each tag in the places sheet and create a checkbox component for each tag column? Then when editing the Place, it would be easy to add or remove tags by simply checking or unchecking the box. Or is your list of tags going to be very dynamic and change a lot?

I don’t expect the tags to change too much for the first couple of months.

However, I do want people to be able to filter places on the map by tags. Right now I am filtering based on the tag lookup. If I used the checkbox approach, is there a way to create a lookup column like this from that data?

You could create an array column in the sheet with sequentially named columns (Tag 1, Tag 2, Tag 3, etc.), but with checkboxes, you would lose the ability to differentiate which column is which. Maybe you could still create the array column like I mentioned above, but create multiple choice components that would allow you to fill each individual column with a tag name from a choice list. This would also allow you to set up filters on each choice component based on selected values in the other choice components, so you wouldn’t have duplicates. In the end, the array column of ‘Tag’ would give you the same functionality of the Lookup column, which in itself, is just an array.

1 Like

You could create an array column in the sheet with sequentially named columns (Tag 1, Tag 2, Tag 3, etc.), but with checkboxes, you would lose the ability to differentiate which column is which.

OK, interesting Jeff. I haven’t encountered the array column feature before. I set this up in a new test project.

https://mighty-tub-7635.glideapp.io/

This would also allow you to set up filters on each choice component based on selected values in the other choice components

Cool, how you were thinking about implementing this?

When I tried to filter the Tag1 choice component options based on the array Tag it did not work. (Based on some research here, even though it lets me do that, dynamic choices are not supported with arrays.)

image

Have you tried this before?

After more experimentation this I have run into several issues on the edit screen:

  • For some reason, the 4 choice components are not pre-populating with the tag values so you can’t see the current data. If there is a value it shows a blank, if there is no value it shows a dash
  • If you select a new value, the filtered choice list behaves as expected but because of the previous issue i
  • I added a text component to display the tag above each choice component but it does not update when you choose a different value from the choice component

So, it seems that these workarounds are not working for me.

This won’t work in either case, because you are in edit mode and have not written anything to the sheet yet. This is the case for both the filter and the text component. Wheat I meant by filtering is to filter based on all of the other column values (T1, T2, T3, T4) that are set by the choice components. not the joined tag list. And yes, I have done it this way before using screen values from each individual column, so I’m pretty confident that it works. I’m guessing that because you are attempting to filter by the entire array, it hasn’t been updated in the sheet yet, but each individual column is being set as you fill in your choices. You will need 3 filter conditions on each choice component.

This is probably because of the above reasons and you are actually filtering out choices that were previous set (including the one set for that tag choice), so they will not show in your choice list and thus cannot display when editing the record again.

2 Likes

Thanks for taking the time to explain the options Jeff.

Because my tag list will be small for a couple of months, I am going to start with using one boolean column for each tag and build out the functionality from there.

1 Like