<p>The reason that you get that error is probably you have some of serie that doens't has client, so during the loop you need to check whether the serie has  client or not, kind of like this:</p>
<pre><code>{% if serie.client|length %}
        {{serie.client.0.title}}
{% endif %}
</code></pre>

CC BY-SA 4.0
2022-09-02T07:34:53.703Z
Of course, I guess my brain stopped working. Taking some R&R. Thank you aodihis.
Markus Anton
CC BY-SA 4.0
2022-09-05T10:34:42.043Z
Ryan Irelan and Andrew Welch also kindly reacted to my question on their [livestream](https://craftquest.io/livestreams/craftquest-on-call-50-twig-and-shortcut-syntax-in-the-craft-cp). As suggested I could use the Collection methods for a more proper form which would result in this: {{serie.client.first().title}}
Markus Anton
CC BY-SA 4.0
2022-09-02T07:10:07.960Z
2022-09-02T07:10:07.960Z
aodihis
<p>So I have a query to return series. At the same time I eager load the series client.</p>
<pre><code>{% set series = craft.entries()
    .section('series')
    .inArchive(false)
    .with('client')
    .collect()
%}
</code></pre>
<p>Now when I dump and die I see all my series correctly, including the eager loaded client.</p>
<p>And when I dump the needed value from the client:</p>
<pre><code>{{dd(serie.client.0.title)}}
</code></pre>
<p>The needed value is returned:</p>
<pre><code>^ &quot;Title&quot;
</code></pre>
<p>But when I output the value through:</p>
<pre><code>{{serie.client.0.title}}
</code></pre>
<p>Than I get the following error:</p>
<pre><code>Error: Method name must be a string
</code></pre>
<p>I cannot find a way to output the value. Do you see what I'm missing?
Thanks in advance.</p>

<templating><error><string><collections>
Accessing eager loaded Collections data
# Accessing eager loaded Collections data

(Asked by: username_0 on 2022-09-01)

So I have a query to return series. At the same time I eager load the series client.
{% set series = craft.entries()
    .section('series')
    .inArchive(false)
    .with('client')
    .collect()
%}

Now when I dump and die I see all my series correctly, including the eager loaded client.
And when I dump the needed value from the client:
{{dd(serie.client.0.title)}}

The needed value is returned:
^ "Title"

But when I output the value through:
{{serie.client.0.title}}

Than I get the following error:
Error: Method name must be a string

I cannot find a way to output the value. Do you see what I'm missing?
Thanks in advance.

**Tags:** templating, error, string, collections


---

## 1 answers

### Answer by username_1 on 2022-09-02. Score: 0 | Accepted answer

The reason that you get that error is probably you have some of serie that doens't has client, so during the loop you need to check whether the serie has  client or not, kind of like this:
{% if serie.client|length %}
        {{serie.client.0.title}}
{% endif %}

> **Comments:**
> **username_0**: Of course, I guess my brain stopped working. Taking some R&R. Thank you username_1.  
> **username_0**: Ryan Irelan and Andrew Welch also kindly reacted to my question on their [livestream](https://craftquest.io/livestreams/craftquest-on-call-50-twig-and-shortcut-syntax-in-the-craft-cp). As suggested I could use the Collection methods for a more proper form which would result in this: {{serie.client.first().title}}  

---

