<p>I have 3 channels: Reviews, Products and UseCases.</p>

<p>In the section "Reviews" an entry has a list of "Products", based on a matrix field. Every block in this matrix field represents one listed "Product". The block contains of two entries (relationship) fields one to an entry of the Products channel and another one to an entry of the UseCases channel.</p>

<p>Now the question: Based on this setup, is it possible to query all Products with relation to a UseCase? (I am struggling because there is no direct relationship but only an indirect one via a Matrix block.)</p>

<p>I am in general relatively familiar with Craft CMS, but unfortunately not on that level of complexity, therefore I am very happy to get your help.</p>

<p>Thank you very much!</p>

CC BY-SA 4.0
2018-10-03T13:06:09.613Z
You mean like this https://craftcms.stackexchange.com/a/25521/5557?
Robin Schambach
CC BY-SA 4.0
2018-10-03T14:17:35.423Z
I am not sure, but I don't think so. The use of "sourceElement' as well as of 'targetElement' requires from my point of view a direct relationship between entries, while I only have an indirect relationship (defined in a matrix block of a third entry).
MISC
CC BY-SA 4.0
2018-10-03T14:19:27.487Z
Yeah your target is a product and the source your matrix block. You want to query for all owners of all matrix blocks that have a certain product/list of products as target so you insert the matrix field handle as link between your entries to tell Craft not to look for matrix elements but for their owners
Robin Schambach
CC BY-SA 4.0
2018-10-03T18:17:55.803Z
I was not successful, but thank you very much.
MISC
<matrix><relations>
Indirect Relationship defined in Matrix Block
# Indirect Relationship defined in Matrix Block

(Asked by: username_0 on 2018-10-03)

I have 3 channels: Reviews, Products and UseCases.

In the section "Reviews" an entry has a list of "Products", based on a matrix field. Every block in this matrix field represents one listed "Product". The block contains of two entries (relationship) fields one to an entry of the Products channel and another one to an entry of the UseCases channel.

Now the question: Based on this setup, is it possible to query all Products with relation to a UseCase? (I am struggling because there is no direct relationship but only an indirect one via a Matrix block.)

I am in general relatively familiar with Craft CMS, but unfortunately not on that level of complexity, therefore I am very happy to get your help.

Thank you very much!

**Tags:** matrix, relations

> **Comments:**
> **username_1**: You mean like this https://craftcms.stackexchange.com/a/25521/5557?  
> **username_0**: I am not sure, but I don't think so. The use of "sourceElement' as well as of 'targetElement' requires from my point of view a direct relationship between entries, while I only have an indirect relationship (defined in a matrix block of a third entry).  
> **username_1**: Yeah your target is a product and the source your matrix block. You want to query for all owners of all matrix blocks that have a certain product/list of products as target so you insert the matrix field handle as link between your entries to tell Craft not to look for matrix elements but for their owners  
> **username_0**: I was not successful, but thank you very much.  

---

## 0 answers

