Dynamic Form Filter

Hello !!
I have a Form with a “type” that a want to filter from a list:

How i want it to work :
1 - select a “type” as filter from a Choice component
2 - The second Choice component will be filtered based on the “type”.


How my spreadsheet is setup :
| INDEX | CATEGORY | TYPE | PRODUCT | PRICE |

The setup in Glideapp :
ColumnGroup

  • Relation : [Index] > [List > Index]
    (This return the INDEXs from my spreadsheet into groups)

ReturnColumn

  • Lookup : Relation Column : PRODUCT
    (This return the PRODUCTS from my spreadsheet into groups)

I have it grouped by TYPE, Now… how can i get the grouped items into the second “choice component”. It has to change dynamic inside the FORM, using the other “choice component”.


I saw this working outside the form… is there a way to work inside the form without the need to sent it?

No, at the moment there’s no way to do this.

A non-scalable workaround is to have multiple choice components for the second one, then hide/show them based on the first one’s choice.

Thanks for the reply ThinhDinh.

I did a workaround like this once.
I use a INLIST with pre-filtered items.

But i would have several of them… for two “choice components”.
If there was a way to get the ITEM from a “choice component” as a filter to the second “choice component”… that would be more clean than several adicional INLISTs.

You can’t do relations within a form but can you create a filter on the second choice based on the first choice selected value using the screen value?

Thanks for the reply Jeff_Hager.

How this is setup?

Just add a filter on your second choice component. In the first dropdown of the choice filter settings, select the column that you want to filter in your second choice list. In the second dropdown, select the screen column value that was set by the first choice component. This will filter out only those choices that are related to your first choice component. Just like what the screenshot shows.

Ok. I tried. No success

My spreadsheet destination is whrere i want to store my data…
So the “Screens” option does’not work.

How i did :
Destinaton Sheet : ORDERS

[1ª Option]
The first choice dropdown, i have the TYPEs i want to search. Pre-filled.

[2ª Option] The second is where i want the ITEMS to be (dynamic), based on the dropdown choise (1)

Can you show a screenshot of the filter settings for the second choice component? Also specify which column is filled by the first choice component and the column you want to filter by in the sheet used for the second choice component. The destination sheet shouldn’t matter.

I’ll share the link of my app… maybe you can say where i went wrong.

https://tender-coat-3963.glideapp.io/

That won’t help me. I would need to see if your settings are wrong or not.

I understand Jeff_Hager.

The first Choise Component is filled from a Choice spreadsheet.
What is ok.

Here is the second Choice Component :

Its values came from a spreadsheet called List, where i have all items from my app… this is my data base.

Here is the filter from the second Choice Component :

It has already a filter by Type of
beverage
. And all happens inside a form.

Is the filter for the second choice component using the screen value to filter only the values from the first choice on the screen?

No. It isn’t using a Screen Value.
I could not set it up correctly. Even the way you explain it, i could only get all items from my List spreadsheet. Like there wasnt a filter in place.

Can you set your app so I can copy it. I don’t know what to tell you without seeing it myself.

https://docs.glideapps.com/all/reference/templates/copy-app-as-template

It is set to copy now. Hope you can help me

I’m not sure why you were just typing in a value instead of using the value set by the first choice component, but this is how it should be set up:

Using the first drink choice components, I selected ‘Tin’ (Latinha). Then I set the filter on the second choice component to filter only the types where the First Type of Drink is the value from the screen (Tin). That way only the choices that match the chosen type are displayed.
image

Pay attention to the fact that I’m using the selected Type of Drink from the Screen.

Here selected Latinha:

Here are the only results that show in the second choice component:

1 Like

Thanks Jeff_Hager.
That helped a lot.
I’m very new to this… by understanding how things works, we can make better applications.

1 Like

Just wanna ask after reading this again Jeff, as I was wandering around this the other day with a client app.

  • I have one column of car brands and one column of car models (one brand can have many models).

  • In the form, I make the user choose the brand in a choice component first.

  • In the second component, with the current screen filtering, I can’t filter the car models by the choice the user has made in the car brands, is that correct?

1 Like

It should work as you describe. That’s what I demonstrated above. I guess I didn’t look at @AugustoMiguel’s sheets, but it’s my understanding that the beverage types and beverages were in the same sheet. The first choice component listed the types of beverages and the second choice component listed the beverage names. Using the chosen value from the first choice I was able to filter the second choice by comparing the type column in the sheet to the screen value of the column set by the first choice component.

2 Likes