<p>Just checked eager-loading a text field in a template and by eager-loading it you are actually converting the field to an array and therefore unable to template it as usual. Eager-loading is generally only useful on fields like categories, assets, and matrixes.</p>

CC BY-SA 3.0
2016-04-07T20:01:00.453Z
Thanks! You are right. Removing the text fields worked. Eager loading the categories (and one asset field I will be adding) should help. :)
Angela
CC BY-SA 3.0
2016-04-08T00:13:06.757Z
Don't forget to eager load the transforms as well if your asset field is using image transforms!
Patrick Harrington
CC BY-SA 3.0
2016-04-07T19:54:13.637Z
2016-04-07T20:12:03.363Z
2016-04-07T20:12:03.363Z
mcclaskiem
<p>I am trying to eager load users in a specific group to reduce queries. I've tried this:</p>

<pre><code>                {% set designers = craft.users({
                    group: 'designers',
                    with: [
                            'userAgencyName',
                            'userAgencyUrl',
                            'userFreelancerAgency',
                            'userDescriptionServices',
                            'userBudget',
                            'userCity',
                            'userStateProvince'
                            ]
                }) %}
</code></pre>

<p>This consists of 5 user text fields and 2 user category fields. Although it's returning the array to string conversion error. </p>

<p>The loop is setup like this:</p>

<pre><code>    {% paginate designers.limit(7) as designers %}

    {# Loop through Designers #}
    {% for designer in designers %} 

    &lt;div class="listing-box"&gt;
        &lt;h1&gt;&lt;a href="/designers/{{ designer.username }}"&gt;{{ designer.userAgencyName }}&lt;/a&gt;&lt;/h1&gt;

        &lt;div class="listing-links"&gt;
            &lt;ul&gt;
                &lt;li&gt;
                {% for category in designer.userFreelancerAgency %}
                &lt;a href="{{ category.url }}"&gt; {{ category }}&lt;/a&gt;
                {% endfor %}    
                &lt;/li&gt;
                {% for category in designer.userBudget %}
                {% if category %}
                &lt;li&gt;                    
                Budgets: &lt;a href="{{ category.url }}"&gt;{{ category }}&lt;/a&gt;                    
                &lt;/li&gt;
                {% endif %}
                {% endfor %}
                {% if designer.userCity | length %}     
                &lt;li&gt;{{ designer.userCity }}, {{ designer.userStateProvince }}&lt;/li&gt;
                {% endif %}
            &lt;/ul&gt;
        &lt;/div&gt;  
        &lt;p&gt;{% if designer.userDescriptionServices %}{{ designer.userDescriptionServices }}{% endif %} 

    &lt;/div&gt;
    &lt;!--End listing-box--&gt;  
   {% endfor %} 
</code></pre>

<p>Thanks in advance for any help you can give!    </p>

CC BY-SA 3.0
2016-04-07T19:47:26.803Z
I think this may be because you are eager-loading text fields, try to remove them from your `with` and then reload template.
mcclaskiem
<users><user-groups><eager-loading>
Eager Loading Users Returning "Array to String Conversion" Error
# Eager Loading Users Returning "Array to String Conversion" Error

(Asked by: username_0 on 2016-04-07)

I am trying to eager load users in a specific group to reduce queries. I've tried this:
                {% set designers = craft.users({
                    group: 'designers',
                    with: [
                            'userAgencyName',
                            'userAgencyUrl',
                            'userFreelancerAgency',
                            'userDescriptionServices',
                            'userBudget',
                            'userCity',
                            'userStateProvince'
                            ]
                }) %}

This consists of 5 user text fields and 2 user category fields. Although it's returning the array to string conversion error. 
The loop is setup like this:
    {% paginate designers.limit(7) as designers %}

    {# Loop through Designers #}
    {% for designer in designers %} 

    
        {{ designer.userAgencyName }}

        
            
                
                {% for category in designer.userFreelancerAgency %}
                 {{ category }}
                {% endfor %}    
                
                {% for category in designer.userBudget %}
                {% if category %}
                                    
                Budgets: {{ category }}                    
                
                {% endif %}
                {% endfor %}
                {% if designer.userCity | length %}     
                {{ designer.userCity }}, {{ designer.userStateProvince }}
                {% endif %}
            
          
        {% if designer.userDescriptionServices %}{{ designer.userDescriptionServices }}{% endif %} 

    
      
   {% endfor %} 

Thanks in advance for any help you can give!

**Tags:** users, user-groups, eager-loading

> **Comments:**
> **username_1**: I think this may be because you are eager-loading text fields, try to remove them from your `with` and then reload template.  

---

## 1 answers

### Answer by username_1 on 2016-04-07. Score: 5 | Accepted answer

Just checked eager-loading a text field in a template and by eager-loading it you are actually converting the field to an array and therefore unable to template it as usual. Eager-loading is generally only useful on fields like categories, assets, and matrixes.

> **Comments:**
> **username_0**: Thanks! You are right. Removing the text fields worked. Eager loading the categories (and one asset field I will be adding) should help. :)  
> **username_2**: Don't forget to eager load the transforms as well if your asset field is using image transforms!  

---

