How to create a Model showing only Parent records to a list of Child Records

I need to create a parent model that only shows records where the record id is in the list of child records returned in my child model. I tried using a condition of:

Matter__c.Id is in the set of values containing Matter__r.Id field returned from any row returned by my child model and am not getting any records returned even though there are records returned in my child model that meet the criteria. Is there a different way to go about this?

Hi, Grace,
So if I understand correctly, you have two models, a parent model and child model. Parent model has a condition where Id is in the list of values for Matter__r.Id for rows in the child model? I have a few thoughts…

  1. For setting your condition, try using the Matter__c field (the reference field on the child object), rather than traversing through the relationship to get Matter__r.Id.
  2. Make sure the lookup field Matter__c is included in the child model.
  3. If you’re still not seeing records in the parent model, it’s possible the condition is being set correctly, but we are not actually querying for the records. Are you attempting to load data into both of these models on page load? Or later (like when a button is clicked)?
Finally, this may or may not be obvious, but your parent model will only evaludate child records that are actually in the child model to determine which parent records to pull. So, if you only load 20 records into the child model, and 10 of these have a value for Matter__c, only 10 records will be brought into the parent model, even if there is a higher record limit on the parent model. It’s a little tricky to pull in all records from the database that have children associated, because you start to run into heap size issues. Does that make sense?
Emily