How to filter parent records based on child record id?

Hi. I’ve a model relationships like this,

Course -> Chapter -> Section -> Question Set -> Question

I’m building a plug-in to generate a link that will link Dato Question records to our front end app. To do that I should know courseUUID and sectionUUID.

The link template is https://courseUUID/sectionUUID/questionUUID.

I can get both courseUUID and sectionUUID using four filters. From Question Set to Course step by step.

But I would appreciate if there’s a way to get both courseUUID and sectionUUID using only two filters, since the other two filters are not important for this case.

How can I get section/course record which contains the question record ID in which the plugin is injected into?

Hey @henok.tesfaye, I would have done the same thing you did. At the moment it is not possible to filter through inverse relationships, so you have to necessarily go through all the relationships from leaf to root, one query at a time, just like you’re doing.