<p>Thank you very much for your support. <strong>The code shown in the question is correct.</strong></p>

<p>I have replaced the relationship field - <strong>and now it works perfect</strong>. The problem could have been that I defined the field first as a number field an then changed to a relationship field - but this is just speculation.</p>

CC BY-SA 3.0
2015-03-27T07:52:36.607Z
2015-03-27T07:52:36.607Z
MISC
<p>I try go get entries (of channel B) related to an entry (of channel A) within a list of entries (of channel A). All entries of channel B have a relationship field and at least one relation to an entry in channel A. But I get no results from channel B. </p>

<pre><code>{% set entries = craft.entries.section('candidates').order('postDate asc') %}
{% for entry in entries %}
    {% set feedbacks = craft.entries.section('candidates_feedbacks').relatedTo(entry.id) %}
    {{ entry.title }}
    {% for feedback in feedbacks %}
        {{ feedback.title }}
    {% endfor %}
{% endfor %}
</code></pre>

<p>What am I doing wrong?</p>

<p>Thank you very much for your feedback.</p>

CC BY-SA 3.0
2015-03-26T13:36:45.370Z
Hmmm, I've just created sections with the same names in Craft and related entries like you are, and your code is working perfectly fine for me.  I'd double check everything is set up correctly in Craft, because that piece of code seems very straightforward.
Jamie Wade
CC BY-SA 3.0
2015-03-26T13:38:40.613Z
Yes, it looks just fine.
carlcs
CC BY-SA 3.0
2015-03-26T15:58:20.367Z
I'd start by `{{ entries|length }}` and `{{ feedbacks|length }}` just to make sure you're getting the results back you're expecting to get back.
Brad Bell
<relations>
Entries related to an entry in a list of entries
# Entries related to an entry in a list of entries

(Asked by: username_0 on 2015-03-26)

I try go get entries (of channel B) related to an entry (of channel A) within a list of entries (of channel A). All entries of channel B have a relationship field and at least one relation to an entry in channel A. But I get no results from channel B. 
{% set entries = craft.entries.section('candidates').order('postDate asc') %}
{% for entry in entries %}
    {% set feedbacks = craft.entries.section('candidates_feedbacks').relatedTo(entry.id) %}
    {{ entry.title }}
    {% for feedback in feedbacks %}
        {{ feedback.title }}
    {% endfor %}
{% endfor %}

What am I doing wrong?
Thank you very much for your feedback.

**Tags:** relations

> **Comments:**
> **username_1**: Hmmm, I've just created sections with the same names in Craft and related entries like you are, and your code is working perfectly fine for me.  I'd double check everything is set up correctly in Craft, because that piece of code seems very straightforward.  
> **username_2**: Yes, it looks just fine.  
> **username_3**: I'd start by `{{ entries|length }}` and `{{ feedbacks|length }}` just to make sure you're getting the results back you're expecting to get back.  

---

## 1 answers

### Answer by username_0 on 2015-03-27. Score: 2 | Accepted answer

Thank you very much for your support. **The code shown in the question is correct.**

I have replaced the relationship field - **and now it works perfect**. The problem could have been that I defined the field first as a number field an then changed to a relationship field - but this is just speculation.


---

