For loop – output a table of liked songs

<!-- Step 1: Retrieve a list of liked songs for the logged in portal user -->
{% fetchxml liked_songs_query %}
  <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="musdyn_like">
    <attribute name="createdon" />
    <attribute name="musdyn_track" />
    <attribute name="musdyn_likeid" />
    <attribute name="musdyn_name" />
    <order attribute="createdon" descending="true" />
    <filter type="and">
      <condition attribute="musdyn_customer" operator="eq" uitype="contact" value="{{ user.id }}" />
      <condition attribute="musdyn_track" operator="not-null" />
    </filter>
    <link-entity name="musdyn_track" from="musdyn_trackid" to="musdyn_track" visible="false" link-type="outer" alias="a_cd305801970beb11a813000d3a0b9232">
      <attribute name="musdyn_trackid" />
      <attribute name="musdyn_name" />
      <attribute name="musdyn_duration" />
      <attribute name="musdyn_audionoteguid" />
      <attribute name="musdyn_artworknoteguid" />
      <attribute name="musdyn_albumfirstreleasedon" />
      <attribute name="musdyn_mainartist" />
      <attribute name="musdyn_featuring" />
    </link-entity>
  </entity>
</fetch>
{% endfetchxml %}

<!-- Step 2: Output the results as a table, including a dislike button -->
{% if liked_songs_query.results.entities.size > 0 %}
  <div class="table-responsive">
    <table class="table table-hover">
      <thead>
        <tr>
          <th>#</th>
          <th>Title</th>
          <th>Album</th>
          <th>Date Added</th>
          <th>Like Status</th>
          <th>Duration</th>
        </tr>
      </thead>
      <tbody>
        {% for result in liked_songs_query.results.entities %}
        <tr data-id="{{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_trackid'] }}">
          <td>{{ forloop.index }}</td>
          <td data-attribute="musdyn_name" data-value="{{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_name'] }}">
          {% if result['a_cd305801970beb11a813000d3a0b9232.musdyn_artworknoteguid'] %}
            <img src="https://songify.powerappsportals.com/_entity/annotation/{{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_artworknoteguid'] }}" alt="Cover artwork for {{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_name'] }} by {{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_mainartist'].name }}">
          {% else %}
            <img src="https://songify.powerappsportals.com/artwork-not-found.svg" alt="Generic music icon, cover artwork not found">
          {% endif %}
          <span class="hero">{{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_name'] }}</span><br>
          {{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_mainartist'].name }}
          {% if result['a_cd305801970beb11a813000d3a0b9232.musdyn_featuring'] %}
          , {{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_featuring'].name }}{% endif %}</td>
            <td data-attribute="musdyn_albumfirstreleasedon">{{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_albumfirstreleasedon'].name }}</td>
            <td data-attribute="createdon">{{ result.createdon| date: 'MMM dd, yyyy' }}</td>
            <td><a class="like-button" item-guid="{{ result.musdyn_likeid }}" href="#" title="Like Button"><span class="glyphicon glyphicon-heart" aria-hidden="true"></a></span></td>
            <td data-attribute="musdyn_duration">{{ result['a_cd305801970beb11a813000d3a0b9232.musdyn_duration'] | round: 2}}</td>
            </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
{% endif %}
Franco Musso