Answers.Body: <p>You can’t use this special Twig function to get reverse related entries at all, as you’re not dealing with reverse relations in that context.</p>
  
  <p>From a <code>stageEvent</code> entry you can just loop through the Super Table rows and get the related <code>artist</code> entry like so:</p>
  
  <pre><code>{% for row in entry.lineUp %}
      {% set artistPerforming = row.artistPerforming.first() %}
  
      {% if artistPerforming %}
          {{ artistPerforming.title }}
      {% endif %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-18T12:18:40.333Z
Answers.LastActivityDate: 2016-11-18T12:18:40.333Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>I'm not sure if there was an update that made this possible, but OPs code worked for me (Craft v3.0.25). Just note that when calling Super Table, it has to be camel case like so <code>...craft.superTable.getRelatedElements...</code> </p>
  
  <p>My version: </p>
  
  <pre><code>{% set relatedMovies = craft.superTable.getRelatedElements({
      relatedTo: {
        targetElement: entry,
        field: 'roles.actor'
      },
      section: 'movies'
  }) %}
  </code></pre>
  
  <p>I am calling this inside of an 'actor' entry template which is referenced here: <code>targetElement: entry</code>.
  Inside the actor template, I want to list all of the movies that the actor was in, hence <code>section: 'movies'</code>. Inside the movie entry, the actor is referenced inside a Super Table field (<code>'roles'</code>) with a row handle of <code>'actor'</code>.</p>
  
  <p>Calling the following produces a list of all the movies the actor has been in. </p>
  
  <pre><code>{% for movie in relatedMovies %}
    &lt;p&gt;{{movie.title}}&lt;/p&gt;
  {% endfor %} 
  </code></pre>
  
  <p>I hope this helps someone that comes across a similar issue!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-26T21:26:06.533Z
Answers.LastActivityDate: 2018-09-26T21:26:06.533Z
Answers.UserDisplayName: andrewmenich
Body: <p>A year ago I asked this question and thanks to the answers I got things working.  A year later and i'm trying to do the same thing on a different website...  only this time it's not working!</p>
  
  <ul>
  <li>Section Handle = <strong>artist</strong></li>
  <li>SuperTable Field Handle = <strong>lineUp</strong></li>
  <li>SuperTable 'Entry' Field = <strong>artistPerforming</strong>, which is linked to Section '<strong>artist</strong>'</li>
  </ul>
  
  <p>Here's my code:</p>
  
  <pre><code>{% set reverseRelatedElements = craft.supertable.getRelatedElements({
      relatedTo: {
          targetElement: entry,
          field: 'lineUp.artistPerforming'
      },
      section: 'artist'
  }) %}
  
  {% for eventLineUp in reverseRelatedElements %}
      {{ eventLineUp.title }}
  {% endfor %}
  </code></pre>
  
  <p>My SuperTable field is assigned to a Section with handle <strong>stageEvent</strong>, so from my <strong>stageEvent</strong> entry i'm trying to pull related entry information from Section <strong>artist</strong>.</p>
  
  <p>Nothing is outputting but I don't get any errors??</p>
  
  <p>Can anyone see what i'm doing wrong?</p>
  
  <p>Many thanks</p>
  
  <p>Martin</p>
  
Tags: <relations><plugin-supertable>
Title: Related Entry within SuperTable
ThreadText: # Related Entry within SuperTable
  
  (Asked by: username_0 on 2016-11-17)
  
  A year ago I asked this question and thanks to the answers I got things working. A year later and i'm trying to do the same thing on a different website... only this time it's not working!
  
  * Section Handle = **artist**
  * SuperTable Field Handle = **lineUp**
  * SuperTable 'Entry' Field = **artistPerforming**, which is linked to Section '**artist**'
  
  Here's my code:
  
  ```
  {% set reverseRelatedElements = craft.supertable.getRelatedElements({
      relatedTo: {
          targetElement: entry,
          field: 'lineUp.artistPerforming'
      },
      section: 'artist'
  }) %}
  
  {% for eventLineUp in reverseRelatedElements %}
      {{ eventLineUp.title }}
  {% endfor %}
  
  ```
  
  My SuperTable field is assigned to a Section with handle **stageEvent**, so from my **stageEvent** entry i'm trying to pull related entry information from Section **artist**.
  
  Nothing is outputting but I don't get any errors??
  
  Can anyone see what i'm doing wrong?
  
  Many thanks
  
  username_0
  
  **Tags:** relations, plugin-supertable
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-11-18. Score: 2 | Accepted answer
  
  You can’t use this special Twig function to get reverse related entries at all, as you’re not dealing with reverse relations in that context.
  
  From a `stageEvent` entry you can just loop through the Super Table rows and get the related `artist` entry like so:
  
  ```
  {% for row in entry.lineUp %}
      {% set artistPerforming = row.artistPerforming.first() %}
  
      {% if artistPerforming %}
          {{ artistPerforming.title }}
      {% endif %}
  {% endfor %}
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2018-09-26. Score: 0
  
  I'm not sure if there was an update that made this possible, but OPs code worked for me (Craft v3.0.25). Just note that when calling Super Table, it has to be camel case like so `...craft.superTable.getRelatedElements...`
  
  My version:
  
  ```
  {% set relatedMovies = craft.superTable.getRelatedElements({
      relatedTo: {
        targetElement: entry,
        field: 'roles.actor'
      },
      section: 'movies'
  }) %}
  
  ```
  
  I am calling this inside of an 'actor' entry template which is referenced here: `targetElement: entry`.
  Inside the actor template, I want to list all of the movies that the actor was in, hence `section: 'movies'`. Inside the movie entry, the actor is referenced inside a Super Table field (`'roles'`) with a row handle of `'actor'`.
  
  Calling the following produces a list of all the movies the actor has been in.
  
  ```
  {% for movie in relatedMovies %}
    <p>{{movie.title}}</p>
  {% endfor %} 
  
  ```
  
  I hope this helps someone that comes across a similar issue!
  
  
  ---
  
  