Hey dear Metabox team,
In Bricks Builder it is relatively easy to query and output a group. But how can you filter or sort them?
I have a similar structure on another site, I made a MB view for it - with help from this community.
But since an MB View doesn't work in a slider in Bricks, I need to create it in Bricks and query it properly.
I know you probably aren't familiar with BricksBuilder, but maybe you can give me a hint on how best to implement this, then I could research further with that information or check the Bricks Documentation.
This is the working MB View, IDs are all the Same in my new Case
{#
Get the settings field
#}
{%
set erste_mannschaft = site.fck.erste_mannschaft
%}
{#
Using a ternary operator: if there are rows in the array
make sure to (|sort) them first on timestamp in reverse order;
and (|filter) so we only keep the timestamps higher than current time;
#}
{% set erste_mannschaft = erste_mannschaft|length >= 1
? erste_mannschaft
|sort( (a,b) => a.date_nextmatch_erste.timestamp < b.date_nextmatch_erste.timestamp )
|filter( v => v.date_nextmatch_erste.timestamp < mb.microtime(true) )
: erste_mannschaft
%}
{# Lets just slice the result to last 3 results #}
{% for clone in erste_mannschaft|slice(0,3) %}
<div class="fck-table">
<p class="c-tagline margin-bottom--s center--self text--center">
{{ clone.Liga_erste.value }} // {{ clone.date_nextmatch_erste.timestamp|date( "d.m.Y \u\m H:i" ) }} Uhr
</p>
<div class="grid--5 fck-next-match">
<div class="col-span--2 fck-team-block-2">
<div class="aspect--1-1">
<img class="aspect--1-1" src="{{ clone.heimmannschaft_erste.thumbnail.medium_large.url }}" width="70" height="70" alt="{{ clone.heimmannschaft_erste.thumbnail.medium_large.alt }}">
</div>
<div class="fck-team-name text--right">{{ clone.heimmannschaft_erste.title }}</div>
</div>
<div class="fck-vs-nextgame">{{ clone.ergebnis_heim_erste }} : {{ clone.ergebnis_auswarts_erste }}</div>
<div class="col-span--2 fck-team-block-2 fck-reverse">
<div class="fck-team-name">{{ clone.auswaerts_erste.title }}</div>
<div class="col-start--2 aspect--1-1">
<img class="aspect--1-1" src="{{ clone.auswaerts_erste.thumbnail.medium_large.url }}" width="70" height="70" alt="{{ clone.auswaerts_erste.thumbnail.medium_large.alt }}">
</div>
</div>
</div>
</div>
{% endfor %}