Sort entries by custom date in Matrix field / Super Table I currently have numerous Super Tables with date fields inside and I am trying to get all table items to list themselves together in date order depending on what the user inputs. I have tried using the Super Sort plugin but haven't had any luck.

Not sure if there is somewhere below where I have gone wrong or misunderstood the documentation. The plugin I am trying to use can be found here

Does anyone know if this is possible with Super Tables or Matrix fields?

The error I'm currently getting is:


  Object of class Craft\ElementCriteriaModel could not be converted to string


protected function doDisplay(array $context, array $blocks = array())   
{
  echo $this-&gt;getAttribute($this-&gt;getAttribute(($context["object"] ?? $this-&gt;getContext($context, "object")), "tourDates", array()), "tourDate", array());
}




if (version_compare(PHP_VERSION, '7', '&gt;=') &amp;&amp; $code === 2 &amp;&amp; 
strpos($message, 'should be compatible with') !== false)
{
    return;
}
parent::handleError($code, $message, $file, $line);




protected function displayWithErrorHandling(array $context, array 
$blocks = array())
{
    try {
        $this-&gt;doDisplay($context, $blocks);
    } catch (Twig_Error $e) {
        if (!$e-&gt;getSourceContext()) {
            $e-&gt;setSourceContext($this-&gt;getSourceContext());
        }


This is the code I current have:

{% set artists = craft.entries.section('artists') %}
{% set entries = artists | supersort('sortAs', '{ tourDates.tourDate }') %}

{% for entry in entries %}

    {% if entry.tourDates %}
        {% for row in entry.tourDates %}
            {{ row.tourDate|date("d/m/Y") }}
        {% endfor %}
    {% endif %}

{% endfor %}


I have also tried:

{% set entries = artists | supersort('sortAs', '{ tourDate }') %}


and 

{% set entries = artists | supersort('sortAs', '{{ artists.tourDates.tourDate }}') %}
I did something like this as a workaround:
Loop over entries, fetching all data you need and adding it to an array. Sorting that array with SuperSort and than displaying all info by looping over the array.

{% set tourDates = [] %}
{% set artists = craft.entries.section('artists') %}
{% for artist in artists %}

    {% if artist.tourDates %}
        {% for row in artist.tourDates %}
            {% set tourDates = tourDates|merge([ {
                'tourDate' : row.tourDate|date("d/m/Y")
            } ]) %}
        {% endfor %}
    {% endif %}

{% endfor %}

{% set tourDates = tourDates | supersort('sortAs', '{{ object.tourDate }}') %}

{% for tourDate in tourDates %}
    {{ tourDate.tourDate }}
{% endfor %}