HubDB loop rows in reverse order

Hi,

Is there a way to loop thorugh HUbDB rows in reverse order, for a “show the top at the top” listing?

I think this old soution isn’t working. Solved: HubSpot Community - Loop hubdb table rows in reverse order - HubSpot Community

That solution relied on `-hs_created_at` -- but this does not account for rows having been subsequently drag-n-drop reordered.

Hi @SimonPadbury

You can use the “reverse” filter in HubL:

{% set table = hubdb_table_rows(table_id) %}

{% for row in table|reverse %}
 <p>{{ row.name }}</p>
{% endfor %}

This will return whatever the naturnal order is in HubDB, but in reverse.

Hope this helps!

Thankyou evaldas. This works perfectly, and is much simpler. :slightly_smiling_face: