Skip to main content
Contributor I
Oct 25, 2024 7:20 PM UTC
Solved

How would I sort an array?

I have an array that I want to sort by expiration date. I’m getting mixed messages on if and how this can be done. I would love any guidance with this code. 

{% for reward in person.x_activeRewards %}
<div>
<p>{{ reward.expirationDate }}</p>
</div>
{% endfor %}

 

    This topic has been closed for replies.
    ArpitBanjara
    Principal User II
    Oct 27, 2024 6:12 PM UTC

    Hey @Bryce 

    I am not 100% sure but can you try to use the ‘sort’ filter?

    something like this - {% assign sorted_rewards = person.x_activeRewards | sort: 'expirationDate' %}

     

    Let me know if this works

    Cheers,

    Arpit Banjara - Lead Email Marketing Specialist at Flowium

    2 replies

    BryceAuthor
    Contributor I
    Oct 25, 2024 11:31 PM UTC

    testing to make sure this thing is on. 

    ArpitBanjara
    Principal User II
    Principal User II
    Oct 27, 2024 6:12 PM UTC

    Hey @Bryce 

    I am not 100% sure but can you try to use the ‘sort’ filter?

    something like this - {% assign sorted_rewards = person.x_activeRewards | sort: 'expirationDate' %}

     

    Let me know if this works

    Cheers,

    Arpit Banjara - Lead Email Marketing Specialist at Flowium