<p>Schoolboy error alert!</p>

<p>I had the wrong field in my news entries. There was a category field set up which had the same values as the sector names. Once I'd replaced the field with the proper one it all worked as expected!</p>

CC BY-SA 3.0
2015-07-03T12:17:25.330Z
2015-07-03T12:17:25.330Z
foamcow
<p>Doing my first Craft job and stuck with a reverse related entries thing. 
I’ve got a channel of “Sectors” and a channel of “News”. The entries in news have a relationship field back to the “Sectors”.
When I’m viewing a “Sector” entry, I want to show links to entries in News that have a relationship to it.</p>

<p>I’ve tried a few things but essentially I’ve got this…</p>

<pre><code>{% extends "_layout" %}

{% block content %}
    &lt;div class="panel"&gt;
    &lt;h1&gt;{{ entry.title }}&lt;/h1&gt;

    {{ entry.body }}
    &lt;/div&gt;

    {% for entry in craft.entries.section('news').relatedTo(entry) %}
        {{ entry.title }}
    {% endfor %}
{% endblock %}
</code></pre>

<p>But, even though I have a news entry related to a specific Sector entry, the above code doesn't show any related entries.</p>

<p>Oddly, if I do this...</p>

<pre><code>{% for entry in craft.entries.section('news').relatedTo(entry) %}
</code></pre>

<p>Then I get some output but it shows me something from a different channel.</p>

<p>I’m confused. Can someone help?</p>

<p><strong>Update</strong></p>

<p>Schoolboy error alert!</p>

<p>I had the wrong field in my news entries. There was a category field set up which had the same values as the sector names. Once I'd replaced the field with the proper one it all worked as expected!</p>

CC BY-SA 3.0
2015-07-02T15:12:47.050Z
You are reassigning the value of the `entry` variable in your `for` loop. What happens when you change the `for` loop to: `{% for relatedEntry in craft.entries.section('news').relatedTo(entry) %}`. Then output `{{ relatedEntry.title }}`.
Steve Rowling
CC BY-SA 3.0
2015-07-02T15:32:07.517Z
I thought that was the problem (and it may have been an issue). But I found the real problem. Stupid error on my part. I'll update my question to explain.
foamcow
CC BY-SA 3.0
2015-07-02T16:49:12.543Z
Glad you got it sorted, @foamcow.  Can you add your update as an official answer?
Brad Bell
<relations>
Reverse Relationships
# Reverse Relationships

(Asked by: username_0 on 2015-07-02)

Doing my first Craft job and stuck with a reverse related entries thing. 
I’ve got a channel of “Sectors” and a channel of “News”. The entries in news have a relationship field back to the “Sectors”.
When I’m viewing a “Sector” entry, I want to show links to entries in News that have a relationship to it.
I’ve tried a few things but essentially I’ve got this…
{% extends "_layout" %}

{% block content %}
    
    {{ entry.title }}

    {{ entry.body }}
    

    {% for entry in craft.entries.section('news').relatedTo(entry) %}
        {{ entry.title }}
    {% endfor %}
{% endblock %}

But, even though I have a news entry related to a specific Sector entry, the above code doesn't show any related entries.
Oddly, if I do this...
{% for entry in craft.entries.section('news').relatedTo(entry) %}

Then I get some output but it shows me something from a different channel.
I’m confused. Can someone help?
Update
Schoolboy error alert!
I had the wrong field in my news entries. There was a category field set up which had the same values as the sector names. Once I'd replaced the field with the proper one it all worked as expected!

**Tags:** relations
> **Comments:**
> **username_1**: You are reassigning the value of the `entry` variable in your `for` loop. What happens when you change the `for` loop to: `{% for relatedEntry in craft.entries.section('news').relatedTo(entry) %}`. Then output `{{ relatedEntry.title }}`.  
> **username_0**: I thought that was the problem (and it may have been an issue). But I found the real problem. Stupid error on my part. I'll update my question to explain.  
> **username_2**: Glad you got it sorted, @foamcow.  Can you add your update as an official answer?  

---

## 1 answers

### Answer by username_0 on 2015-07-03. Score: 1 | Accepted answer

Schoolboy error alert!

I had the wrong field in my news entries. There was a category field set up which had the same values as the sector names. Once I'd replaced the field with the proper one it all worked as expected!


---

