1
% set entriesList = craft.entries.section('parks').relatedTo(entry.Line.one()).all %}
    {% if entriesList|length %}
    <div id="found-in" class="park">
        <ul>
            {% for entry in entriesList %}
            <li><a class="underline" href="{{entry.url}}">{{entry.title}}</a></li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

Every Element has a Table where a Number is set I want to order it by the Number. How can i do it?

Thanks

1

orderBy() should do the trick. The docs show following syntax: .orderBy('elements.dateCreated asc')

Maybe something like:

{% set entriesList = craft.entries.section('parks')
   .relatedTo(entry.Line.one())
   .orderBy('elements.tableName.row(n).columnName asc')
   .all
%}
8
  • Nope. Just a Error. :/
    – Markus
    Dec 10 '18 at 12:16
  • Have you replaced tableName, n and columName with your specific details? Maybe use [] instaed of () for the row "elements.tableName.row[n].columnName"?
    – phaetons
    Dec 10 '18 at 13:35
  • Another possible solution: .orderBy('elements.tableFieldName[n] asc') where n = row number
    – phaetons
    Dec 10 '18 at 13:43
  • tableName and columnName - Yes but what is the n for? I thought near.
    – Markus
    Dec 10 '18 at 14:35
  • .orderBy('elements.parkInfo.row(n).person asc')
    – Markus
    Dec 10 '18 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.