Trouble filtering repeating group by dropdown values

Hi! I’m running into an issue where I need a dropdown’s value of either Bike, Snowboard, Surfboard to filter a repeating group.

The repeating group and dropdown live on separate pages, with the dropdown’s value being sent as a parameter to the next page (retail item = dropdown’s value). And the repeating group contains a cell that shows a list of categories belonging to a particular store.

I created a custom state on the repeating group but I keep getting this error saying that the filter must be ‘yes/no’ and i’m not sure why as the list_of_categories data field is a list that references another data type (categories).

Home Page w/ Category Dropdown:

2nd page, customer state on Repeating Group:

2nd page, w/ Error Message on Repeating Group:

I thought that by making a custom state I’d be able to utilize the Advanced filter but I really can’t figure out why I’m doing wrong.

In general, I think you can simplify this significantly. You could skip the custom state and also the advanced filter.

In the RG, in the “Search for” box, have a constraint say something like… categories contains get data from page URL. That will pull up a box with settings to pull the data from the URL. The category should be visible in your URL when you test it. [Correction/Edit: this expression only works if your categories are a list of texts. As @rpetribu correctly notes, if they are a list of another datatype, then I think the expression is… categories contains search for categories, and in the “search for categories” searchbox you can search based on the text name from the URL].

Note:

  • Regarding a custom state, I’m not sure why you’d need it. To use it you’d need to have a workflow to set the state upon page load based on the URL. The above avoids that entirely.
  • Regarding a :filter or advanced filter – rule of thumb is to use the “search for” box before resorting to those. “:filter” and “advanced filter” are executed client side and are slower on large sets of data.

@ed727, I have tried that but unfortunately when I test this out using a category (bikes) that is ties to a particular store, the repeating group disappears completely as if there isn’t a store that meets the query, even though I know there is at least one that should.

That’s how I came to the idea of using the advanced filter for this, but maybe it’s just my repeating group or the way I am sending the parameter data? Any other suggestions?

This type of search doesn’t require an advanced filter. The issue probably is the way you are passing data via the URL.

I would start by putting the dropdown on the page where you have the RG and then testing the RG functionality (have the RG search reference the option from the dropdown). Once you get that working, then you know you have the dropdown and the RG search working correctly.

Then put the dropdown on a different page and fiddle with the settings to pass and receive the data via a URL parameter.

@sydneyng The problem is that your Store’s list_of_categories is probably a list of another database object (Categories, probably).

What you are sending thru the URL is a TEXT. Not an object.
So, when you try to use “contain”, you will get nothing, because it is expecting an object and not a text.

What you can do is use a “Search for” in your RG, as @ed727 told. Forget the custom state…

But you will have to make a search constraining Stores that contains categories where the NAME is the URL variable…

I am supposing it. Without see you database, it is difficult to guess…

@rpetribu you’re correct that the Store’s list of categories is a list, pulling category names from Category.

I did the following as you recommended:

‘Get Data from URL’ set up:
image

The RG continues to be blank even though the parameter is set to the ‘Category’ data type.

I feel like we’re close…still can’t figure it out. Let me know if there’s additional info about my DB that’s needed!

Do this:

Note that, in my test, I am using a Dropdown’s value instead of getting the value from the URL.
Just change this.

It worked here :+1:
Tell me if worked for you!

@rpetribu that’s funny, I was just going to double respond and let you know I was able to do the same with the dropdown’s value!

I also realized I can make the default value of the dropdown, be the parameter (rental-item) which comes from the home page. EXCEPT the default value isn’t being recognized as one of the category options found in the DB.

Screen when I send ‘Surfboard’ as retail-item parameter to next page’s dropdown:

Notice here that when i click on the dropdown, that’s when you see that ‘Surfboard’ isn’t actually associated with the Surfboard Category name, thus causing no search results:

I’m wondering if I set up the dropdown’s default value incorrectly?:

The problem is the type of data you are SENDING or GETTING from your URL.
Both should be TEXT, not CATEGORY.

Tested as well here. It worked :grinning:

Just a tip… In the second page, unlink the placehold of your dropdown from the URL parameter. You just need this as the defalut value of your dropdown.

@rpetribu Not sure what i’m doing wrong but the ‘Default Value’ is still asking for a Category type of data/asking for more.

My workflow for sending the parameter ‘rental-item’ to search results page:

Search Page’s dropdown:

Hummmm… lets see…

Your dropdown (located in your second page) should be like this:

image

The URL parameter is a TEXT. So your Dropdown must be a list of TEXT and not a list of CATEGORIES.

I’m going mad with these errors, @rpetribu :sweat_smile:

The RG doesn’t seem to like the inputs

:joy:

Send me a print of your database Categories

Categories:

Stores:

The Store data type includes a list of categories as you can see

In your dropdown change the “Type of choice” to Text instead Category. :slightly_smiling_face:

1 Like

@rpetribu Genius! Thank you!!
The dropdown works as should. But now that the dropdown is a text, the RG is looking for the filter type to be a ‘Category’ and won’t accept the dropdown value since it’s a text :joy:.

You can see that I attempted the ‘Advanced’ filter you suggested and the inconsistencies in data types are coming up again:

If I make the 'Get URL parameter type a ‘Category’, the RG goes blank because of the different data types. Any suggestions on workarounds?

I figured out the last piece of the puzzle! :partying_face:

My RG settings:

@rpetribu, @ed727 thanks for all the help!

1 Like

:joy: finally!
Glad i helped