Liquid – Query and Loop through events

{% fetchxml tour_dates_query %}
    <fetch version="1.0" mapping="logical" no-lock="false">
    <entity name="musdyn_tourdate">
    <attribute name="musdyn_name"/>
    <order attribute="musdyn_startdateandtime" descending="false"/>
    <filter type="and"><condition attribute="statecode" operator="eq" value="0"/></filter>
    <attribute name="musdyn_venue"/>
    <attribute name="musdyn_tour"/>
    <attribute name="musdyn_ticketavailability"/>
    <attribute name="statuscode"/>
    <attribute name="musdyn_startdateandtime"/>
    <attribute name="musdyn_tourdateid"/>
    <attribute name="musdyn_endtimeanddate"/>
    <attribute name="musdyn_alldayevent"/>
    <attribute name="musdyn_bookinglink"/>
    <link-entity name="musdyn_tour" from="musdyn_tourid" to="musdyn_tour" link-type="outer" alias="tour" visible="false">
    <attribute name="musdyn_description"/>
    <attribute name="musdyn_mainartist"/>
    <attribute name="musdyn_artwork_url"/>
    </link-entity>
    </entity>
    </fetch>
{% endfetchxml %}

{% if tour_dates_query.results.entities.size > 0 %}
[
    {% for result in tour_dates_query.results.entities %}
        {
        "id": "{{ result.musdyn_tourdateid }}",
        "title": "{{ result.musdyn_name }}",
        "start": "{{ result.musdyn_startdateandtime | date_to_iso8601 }}",
        "end": "{{ result.musdyn_endtimeanddate | date_to_iso8601 }}",
        "extendedProps": {
            "venue1": "{{ result.musdyn_name }}",
            "venue2": "{{ result.musdyn_venue }}",
            "artist": "{{ result['tour.musdyn_mainartist'].name }}",
            "tour": "{{ result.musdyn_tour.name }}",
            "ticket_availability": "{{ result.musdyn_ticketavailability.label }}",
            "purchase_url": "{{ result.musdyn_bookinglink }}",
            "description": "{{ result['tour.musdyn_description'] | escape }}",
            "artwork": "{{ result['tour.musdyn_artwork_url'] | url_encode }}",
            "tour_id": "{{ result.musdyn_tour.id }}",
        },
    }{% unless forloop.last %},{% endunless %}
    {% endfor %}
]
{% endif %}
Franco Musso