Sort listview based on calculated attribute

1
Hi all,   I've got a calculated attribute that returns an integer value. In a listview, I want to sort based on this calculated value. However, both the listview sort function and the microflow retrieve do not allow sorting based on calculated values, returning the error message "Sorting on calculated attribute [attribute name] is not supported”.   What's the best workaround for this? I've tried to change the attribute from calculated to stored, but because the calculation is based on multiple many to many associations, this is very unpractical and makes the app slow.   Cheers!   Paul    
asked
2 answers
2

Hi Paul,

I’d opt for a stored attribute, as you already suggested. It shifts the calculation load from retrieving to committing, but that is a process a user usually is more used to or more forgiving in taking a second or two. Just include the calculation in you object Save or BeforeCommit microflow.

Good luck!

answered
1

You could make the datasource of the list view a microflow in which you first calculate the attribute for each object trough a loop and then sort the list by using a sort action before returning it to the list view.

This way you're also changing the calculated attribute into a stored attribute which (usually) benifits performance

answered