Realm Studio syntax filtered list of results based on linked object

370 Views Asked by At

What is the proper way to query in Realm Studio and retrieve a list of objects that satisfy one condition as well as satisfying the state of linked records

Example

ObjectB { id: STRING included: BOOL }

ObjectA { id: STRING subID: STRING objBArray: List }

so what would the query be if I want to get back all ObjectA's that have an subID of "123" and only if one of the elements in objBArray's isIncluded = true

When looking at the ObjectA Table:

subID = "123" and $0.objBArray.isIncluded == true

1

There are 1 best solutions below

0
justdan0227 On BEST ANSWER

So it turns out I needed to use "AND ANY linkedobjects.Id = nil" it was the combination of AND along with ANY followed by the "array/list" of objects and condition