<p>I have not worked with Lowblocks yet, but it looks like it returns an array of Matrix block models. To get to the related entries you need to access the <code>owner</code> property.</p>

<pre><code>{% set entryIds = [] %}
{% for sown in allSown %}
    {% set blockId = sown.id %}
    {% set entryIds = entryIds|merge([blockId.owner.id]) %}
{% endfor %}
</code></pre>

<p>But do you really need those entry IDs? You could just display the blocks?</p>

<pre><code>{% for sown in allSown %}
    {{ sown.owner.title }}
    {{ sown.sowingLocation }}
    {{ sown.sowingDate }}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2015-03-31T07:26:11.733Z
hmm tried that but I am getting this: Object of class Craft\ElementCriteriaModel could not be converted to string

/home/aaronjay/craft/templates/index.html(-1)
Aaron
CC BY-SA 3.0
2015-03-31T07:30:09.430Z
What gives you this error? The line you print owner.title?
carlcs
CC BY-SA 3.0
2015-03-31T07:35:02.650Z
nah the date - {{ sown.sowingDate|date("d - M") }}  this resolved it when I take the {{ sown.sowingLocation }} out.
Aaron
CC BY-SA 3.0
2015-03-30T23:26:13.390Z
2015-03-30T23:34:47.547Z
2015-03-30T23:34:47.547Z
carlcs
<p>I have an entries in a section called 'garden', with a matrix field called 'sowing' - this matrix has a block called 'locationDate' and two fields 'sowingDate' and 'sowingLocation'.</p>

<p>I want to loop through and show the last 5 things sown in the garden, so based on other examples and using low blocks, I have this code:</p>

<pre><code>{% set allSown = craft.lowblocks.blocks.fieldId(12).type("locationDate").order("sowingDate").limit(5) %}
{% set entryIds = [] %}

{% for sown in allSown %}
    {% set entry = sown.title %}
    {% set entryIds = entryIds | merge([entry.id]) %}
{% endfor %}

{% set entries = craft.entries.section("garden").id(entryIds).fixedOrder(true).status("live,pending") %}

{% for sown in entries %}
    {{ sown.title }}&lt;br /&gt;
{% endfor %}
</code></pre>

<p>So my question is, why can't I view the entries, and what do I need to do to display the date of the matrix field? It seems like it should working, but I am missing something for sure. </p>

<p>** note I need to have a matix date there as there are often multiple sowing locations and dates per entry. </p>

<matrix><datetime>
How do I sort and display by a matrix date field?
# How do I sort and display by a matrix date field?

(Asked by: username_0 on 2015-03-30)

I have an entries in a section called 'garden', with a matrix field called 'sowing' - this matrix has a block called 'locationDate' and two fields 'sowingDate' and 'sowingLocation'.
I want to loop through and show the last 5 things sown in the garden, so based on other examples and using low blocks, I have this code:
{% set allSown = craft.lowblocks.blocks.fieldId(12).type("locationDate").order("sowingDate").limit(5) %}
{% set entryIds = [] %}

{% for sown in allSown %}
    {% set entry = sown.title %}
    {% set entryIds = entryIds | merge([entry.id]) %}
{% endfor %}

{% set entries = craft.entries.section("garden").id(entryIds).fixedOrder(true).status("live,pending") %}

{% for sown in entries %}
    {{ sown.title }}
{% endfor %}

So my question is, why can't I view the entries, and what do I need to do to display the date of the matrix field? It seems like it should working, but I am missing something for sure. 
** note I need to have a matix date there as there are often multiple sowing locations and dates per entry.

**Tags:** matrix, datetime


---

## 1 answers

### Answer by username_1 on 2015-03-30. Score: 2 | Accepted answer

I have not worked with Lowblocks yet, but it looks like it returns an array of Matrix block models. To get to the related entries you need to access the owner property.
{% set entryIds = [] %}
{% for sown in allSown %}
    {% set blockId = sown.id %}
    {% set entryIds = entryIds|merge([blockId.owner.id]) %}
{% endfor %}

But do you really need those entry IDs? You could just display the blocks?
{% for sown in allSown %}
    {{ sown.owner.title }}
    {{ sown.sowingLocation }}
    {{ sown.sowingDate }}
{% endfor %}

> **Comments:**
> **username_0**: hmm tried that but I am getting this: Object of class Craft\ElementCriteriaModel could not be converted to string  /home/aaronjay/craft/templates/index.html(-1)  
> **username_1**: What gives you this error? The line you print owner.title?  
> **username_0**: nah the date - {{ sown.sowingDate|date("d - M") }}  this resolved it when I take the {{ sown.sowingLocation }} out.  

---

