Accessing sub-fields in repeating group's constriaints

This is what i’m trying to do: let’s say i want a repeating group to display from my dataset of “Companies” only the ones that have a “CEO” which “Age” is = 40, very stupid example but this way it’s easier to explain beacause what i’m trying to do is more abstract. So, the field “CEO” is an object “Person” which has the fields “Name”, “Age”, and other fields.
So the repeating group has Type of content = Company, and Data source = Search for Companies, but when i’m trying to put the constraint on the CEO, i cannot access his field Age like this CEO’s Age = 40, i only have access to these options

I don’t understand what am i missing out and how i should do this

Hi there, @a.blackout98… what you have described would need to be done with an advanced filter. So, instead of selecting the CEO field as the constraint, you would scroll to the bottom of the dropdown and select Advanced. Then, you would be able to construct an expression such as This Company's CEO's Age = 40. Now, keep in mind that advanced filters take place on the client side, so the search for companies is going to return every company to the browser, and then the filter will be applied. As you can imagine, that might not be ideal from a performance perspective, so the more constraints you can put on the search for companies, the better.

Hope this helps.



Yep, as @mikeloc points out, you can only access a thing’s fields in search constraints (not fields of things connected to the thing)… so to do this with your current database setup you’ll need to use an advanced filter.

Advanced filters run client-side so can be much slower with larger datasets… using more constraints and also privacy rules can help keep the returned results as small as possible…

Generally though, whenever possible (and especially if performance becomes an issue), it’s a good idea to design your database in the way that will allow the most efficient and performant searches…

So, in your above hypothetical example, you might want to consider adding a number field directly on the Company datatype for ‘CEO Age’. You’d need to make sure you update that field anytime the Age field on the CEO datatype changes, but that will make your searches much simpler to set up, and a lot faster to run.


Ok got it, thanks to both of you for the really good advices!

1 Like