Related Entry within SuperTable 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

Martin
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 %}