<p>I'm trying to set a variable to a Matrix field and apply additional query parameters like so:</p>

<pre><code>{% set monthDates = entry.scanDates.type('dates').date('and', '&gt;= ' ~ currMonthFirst|date('Y-m-d'), '&lt; ' ~ nextMonthFirst|date('Y-m-d')) %}
</code></pre>

<p>I want to have a set of dates based on a date range, but I'm getting a "Calling unknown method: craft\behaviors\ElementQueryBehavior::date()" </p>

<p>The name of the Matrix field is <code>scanDates</code> with block type <code>dates</code> and field name <code>date</code>.</p>

<p>The following code with just one parameter works just fine, so it must be the syntax that is wrong in the first example. </p>

<pre><code>{% set monthDates = entry.scanDates.type('dates').date('&gt;= ' ~ nextMonthFirst|date('Y-m-d')) %}
</code></pre>

<p>What is the correct syntax to narrow down the results based on multiple conditions?  `</p>

CC BY-SA 4.0
2020-05-16T15:05:14.223Z
I am having the same issue—did you ever find a solution? Thanks.
univers_
CC BY-SA 4.0
2020-05-18T00:22:18.743Z
@univers_ I wasn't able to figure out why it wasn't working so I found a different way to do what I need.
SoHo
<craft3><matrix><elementcriteriamodel>
Setting a variable to a Matrix field with additional parameters
# Setting a variable to a Matrix field with additional parameters

(Asked by: username_0 on 2019-06-11)

I'm trying to set a variable to a Matrix field and apply additional query parameters like so:
{% set monthDates = entry.scanDates.type('dates').date('and', '>= ' ~ currMonthFirst|date('Y-m-d'), '< ' ~ nextMonthFirst|date('Y-m-d')) %}

I want to have a set of dates based on a date range, but I'm getting a "Calling unknown method: craft\behaviors\ElementQueryBehavior::date()" 
The name of the Matrix field is scanDates with block type dates and field name date.
The following code with just one parameter works just fine, so it must be the syntax that is wrong in the first example. 
{% set monthDates = entry.scanDates.type('dates').date('>= ' ~ nextMonthFirst|date('Y-m-d')) %}

What is the correct syntax to narrow down the results based on multiple conditions?  `

**Tags:** craft3, matrix, elementcriteriamodel

> **Comments:**
> **username_1**: I am having the same issue—did you ever find a solution? Thanks.  
> **username_0**: @username_1 I wasn't able to figure out why it wasn't working so I found a different way to do what I need.  

---

## 0 answers

