<p>I didn't test it yet but it should like this :</p>

<pre><code>{% set entries = craft.entries().section('schedules').all() %}
{% for entry in entries %}
{% for block in entry.stageSchedule : %}
    {% if block.type == 'yourblocktype' : %}
         {% for item in block.schedule %}
            {{ item.timeOn }}
         {% endfor %}
    {% endif %}
{% endfor %}
{% endfor %}
</code></pre>

<p>I assume there is only one entry in schedules sections.
Please be remind block type is different with block name. 
Hope this help.</p>

CC BY-SA 4.0
2020-04-26T18:23:59.797Z
Hi @aodihis, there are more than one entries because there are more than one stages.  I have tried your solution as follows but I get an error (Key "stageSchedule" for array with keys "0, 1" does not exist.).   {% set entry = craft.entries().section('shedules').all() %}
  {% for block in entry.stageSchedule %}
      {% if block.type == 'dayOfEvent' %}
           {% for item in block.schedule %}
              {{ item.timeOn|datetime('short') }}
           {% endfor %}
      {% endif %}
  {% endfor %}
Martin
CC BY-SA 4.0
2020-04-27T13:48:11.260Z
@Martin , I see so we need to do a loop for each entry. I have updated the answer.
aodihis
CC BY-SA 4.0
2020-04-27T17:11:54.847Z
Hi @aodihis, thank you but I can't see how your solution is looking for the reverse relation with 'artist'?  ---  I have edited my post with more information if it helps?
Martin
CC BY-SA 4.0
2020-04-26T13:13:34.037Z
2020-04-27T13:46:55.940Z
2020-04-27T13:46:55.940Z
aodihis
<p>Ok, my mind is about to implode with this… any help on template syntax very welcome!</p>

<p>I have 2 Sections: ‘<strong>artists</strong>’ and ‘<strong>schedules</strong>’</p>

<p>In the ‘<strong>schedules</strong>’ section I have a Matrix field called ‘<em>stageSchedule</em>’, with a Block type called ‘<em>dayOfEvent</em>’</p>

<p>In that Block type I have a <strong>Super Table</strong> field called ‘<em>schedule</em>’. - breakdown....</p>

<ul>
<li><strong>schedules</strong> (Section)</li>
<li><ul>
<li><em>stageSchedule</em> (Matrix) > <em>dayOfEvent</em> (Block)</li>
</ul></li>
<li><ul>
<li><ul>
<li>schedule (Block field (Super Table)) - ST</li>
</ul></li>
</ul></li>
</ul>

<p>In ‘<em>schedule</em> (ST)’ I have a date field called ‘<em>timeOn</em>’, which is when the artist is due to be on stage. I thought I could get this information from ‘<em>schedule</em> (ST)’ by having an ENTRIES field called '<strong><em>act</em></strong>' (in the same ST field) which is linked to a specific artist from the ‘<strong>artists</strong>' section.</p>

<p>What I want to do... On the individual ‘Artist Bio’ pages I want to display what time they’re going to be on stage by pulling that information from ‘schedule > stageSchedule (M) > dayOfEvent (B) > schedule (ST) > ‘timeOn’.</p>

<p>I have tried every which way but I either get an error or nothing at all :/</p>

<p>I hope that makes sense... Thanks to anyone who can work this one out!</p>

<p><strong>EDIT</strong></p>

<p>As a test I created a Super Table field on it's own (not within Matrix)  and got the data correctly using this:</p>

<pre><code>{% set reverseRelatedElements = craft.superTable.getRelatedElements({
    relatedTo: {
      targetElement: entry,
      field: 'testTimes.artist' // Super Table Field
    },
    section: 'schedules’
  }) %}

  {% for relatedEntry in reverseRelatedElements %}
    {{ relatedEntry.testTimes.timeon|datetime('H:i') }}
    {{ relatedEntry.testTimes.timeOff|datetime('H:i') }}
  {% endfor %}
</code></pre>

<p>So basically I need to do the same but target a Super Table field nested in a Matrix field?  Here's an image...</p>

<p><a href="https://i.sstatic.net/eBLGO.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eBLGO.jpg" alt="enter image description here"></a> </p>

<matrix><relatedto><plugin-supertable>
Pull info from a Related field within Matrix > within Super Table
# Pull info from a Related field within Matrix > within Super Table

(Asked by: username_0 on 2020-04-25)

Ok, my mind is about to implode with this… any help on template syntax very welcome!
I have 2 Sections: ‘artists’ and ‘schedules’
In the ‘schedules’ section I have a Matrix field called ‘stageSchedule’, with a Block type called ‘dayOfEvent’
In that Block type I have a Super Table field called ‘schedule’. - breakdown....

schedules (Section)

stageSchedule (Matrix) > dayOfEvent (Block)



schedule (Block field (Super Table)) - ST



In ‘schedule (ST)’ I have a date field called ‘timeOn’, which is when the artist is due to be on stage. I thought I could get this information from ‘schedule (ST)’ by having an ENTRIES field called 'act' (in the same ST field) which is linked to a specific artist from the ‘artists' section.
What I want to do... On the individual ‘Artist Bio’ pages I want to display what time they’re going to be on stage by pulling that information from ‘schedule > stageSchedule (M) > dayOfEvent (B) > schedule (ST) > ‘timeOn’.
I have tried every which way but I either get an error or nothing at all :/
I hope that makes sense... Thanks to anyone who can work this one out!
EDIT
As a test I created a Super Table field on it's own (not within Matrix)  and got the data correctly using this:
{% set reverseRelatedElements = craft.superTable.getRelatedElements({
    relatedTo: {
      targetElement: entry,
      field: 'testTimes.artist' // Super Table Field
    },
    section: 'schedules’
  }) %}

  {% for relatedEntry in reverseRelatedElements %}
    {{ relatedEntry.testTimes.timeon|datetime('H:i') }}
    {{ relatedEntry.testTimes.timeOff|datetime('H:i') }}
  {% endfor %}

So basically I need to do the same but target a Super Table field nested in a Matrix field?  Here's an image...

**Tags:** matrix, relatedto, plugin-supertable

---

## 1 answers

### Answer by username_1 on 2020-04-26. Score: 1

I didn't test it yet but it should like this :
{% set entries = craft.entries().section('schedules').all() %}
{% for entry in entries %}
{% for block in entry.stageSchedule : %}
    {% if block.type == 'yourblocktype' : %}
         {% for item in block.schedule %}
            {{ item.timeOn }}
         {% endfor %}
    {% endif %}
{% endfor %}
{% endfor %}

I assume there is only one entry in schedules sections.
Please be remind block type is different with block name. 
Hope this help.

> **Comments:**
> **username_0**: Hi @aodihis, there are more than one entries because there are more than one stages.  I have tried your solution as follows but I get an error (Key "stageSchedule" for array with keys "0, 1" does not exist.).   {% set entry = craft.entries().section('shedules').all() %}   {% for block in entry.stageSchedule %}       {% if block.type == 'dayOfEvent' %}            {% for item in block.schedule %}               {{ item.timeOn|datetime('short') }}            {% endfor %}       {% endif %}   {% endfor %}  
> **username_1**: @Martin , I see so we need to do a loop for each entry. I have updated the answer.  
> **username_0**: Hi @aodihis, thank you but I can't see how your solution is looking for the reverse relation with 'artist'?  ---  I have edited my post with more information if it helps?  

---

