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).
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 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:
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
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 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 .
You can see that I attempted the ‘Advanced’ filter you suggested and the inconsistencies in data types are coming up again: