Do a search - applying constraints on another data type that has a range field

I have what seems like simple problem with a (so-far) impossible solution.

I have data type Company and data type Activity.

Each Activity is assigned 1) a Company (i…e, each Company has has field type Activity, which is a list of Activtys associated with that company) and 2) each Activity has a field Age Range (e.g., to represent an activity like a summer camp that is just for 9-12 year olds).

I want my search page to return Companies that have at least one Activity that meets a user’s search criteria for Age (e.g., if the user’s child is 8, the search should only return Companies that have at least one Activity with an Age Range that contains 8).

There doesn’t seem to be a way to return these results in a RG, since Do a Search for Companys can’t search for an Activity’s age range. I’ve reached so many dead ends.

Right now, I have workflows that create a list of Age Ranges for each company (from each Activity associated with that Company). But Do a Search doesn’t seem to search a list of ranges, and the :filtered operator with the Contains constraint on the list of Age Ranges doesn’t seem to work either either.

Any help is appreciated. I’m stuck. Am I thinking about this entirely in the wrong way…is there a better/viable approach? Thanks!

How are you storing the range?

Thanks for asking. Some of these steps may be redundant (because I’ve been experimenting w/different data structures/workflows). But the gist of it is that in Step 4 when a user creates an activity, a workflow adds a numeric range to a Company field that is a list of ranges.

image

image

image

When a user makes a change to any Activity’s Age Range, I use set list to “refresh” the list of all Age Ranges associated with the company.

The idea is that I’d be able to use Search for Companys on a repeating group on the user-facing search page to search for Companies that have Activities that meet a user’s search criteria (e.g., to only show Companies that have Activities with age ranges that meet the user’s search criteria). The user would then click on a company to click through to the company page that displays more company information and more Activity details (in another repeating group of Activity data type).

My Company data looks like this:

image

Hope this helps, and thanks for any help!

This topic was automatically closed after 70 days. New replies are no longer allowed.