Sort by divison of two column values?

Hi guys!

I’m sorry for bothering you all the time with my questions… But I once again have a small question.

Lets say I have a table with properties like numNominations and numWonAwards. I know how to sort desc and asc on each of the properties individually and also on both of them by priority. But the thing I’m after now is if there is a way to sort by a calculated value numWonAwards/numNominations directly in the query (in swift) or do I have to save a new property in the table like “numAwardsPerNomination” where I calculate this already when saving the objects?

Thanks,
Tobias

Hi Tobias,

No, there is no way to sort by a result of an operation performed on column values. You could create a custom server-side event handler which would pre-calculate the value and store it in the object. That way you could sort by that additional column.

Regards,
Mark