How to use intersect

I am trying to display a list of classes in my app (classes are a datatype).

I have a repeating group, and I need to filter the classes to only display the classes that are applicable to the dog.

Dog has Dog_grades which is a list of grades, Class has Class_grades which is a list of grades. Grades are an option set.

I think I need to use an intersect but cant seem to set this up correctly,

2 Likes

It appears that your expression is not returning a list because it’s comparing it to a “current cell” element, which is a single element.

Try adding a convert to list to the end of this expression and see if it works.

Search for Classes intersect with current cell's Dog's Dog Grades: count>0

the main search is a list - it is a repeating group and I end up with a long list of classes. I want this list of classes to show only the classes applicable to the dog so where the class grades (which are a list of grades) match the dog grades (which is also a list of grades). the reference to current cell is that this repeating group sits within a list of dogs so it is searching for classes relevent to the dog.

adding the count still doesnt create a valid expression

Count should be outside the ).

The data source MUST be a list of Classes - NOT a boolean (as you’re suggesting)

you can ONLY use intersects to compare 2 lists of the same type.

i.e. 2 lists of classes OR 2 lists of Grades.

You can’t compare a list of Classes with a List of Grades (which is what your expression is currently trying to do.

Without seeing your full database structure it’s hard to say what the best way to do this is…

The simplest would be to have the Class stored on the DogGrade (if that’s applicable) - then you can simply use the Current Cell’s Dog’s Dog Grades’ Classes as the datasource.

Otherwise you’ll need to use an advanced filter - to filter the Classes where the Class Grades match the Dog’s Grades.

e.g.

Advanced Filter: This Class’s Grades intersect with Current Cell’s Dog’s Grades > 0