Is there a way to search a list based on items in a sublist?
For example: suppose we have a thing type “County” with a field Cities that’s a list of “City” things; and each City thing might have a “Name” (text).
In this scenario, how would you search for all County things whose Cities includes a City entry with Name=“Springfield”?
The best I’ve been able to come up with is to start with a list of all Countys, then use a filter to evaluate the Cities sublist of each:
Search for County [no constraints]: filtered by -> Advanced: This County’s Cities: filtered by -> Name=“Springfield” : count>0
Is this the right approach?
The alternative is for each sublist to link back to its parent… in other words, each City thing includes a field “ParentCounty,” of type County. Then you could do,
Search for City [constraint:Name = Springfield]'s ParentCounty
Both of these routes seem unnecessarily complicated for this task. Am I missing something?
continuing with your example, here is what I do to solve this problem:
I create a new field for Counties called City as texts (type: text)
Whenever I set or add cities to a county I use: make changes to thing: counties: this counties city as texts =this counties’ list of Cities’ city names.
As with any approach there are some limitations as it is not a fuzzy search (which the search autocorrect plugin allows but this plugin does not scale well with 100s of entries), and by using “text contains”: if one city is called field and another springfield you can have unwanted overlaps.
hope I understood you correctly and this helps
happy bubbling,
Julius