Aggregate Model ORDER BY

Is there a special trick to ORDER aggregate rows by one of the aggregate fields on a model? The error is giving me something like:

No such column 'field1' on Object

Which is obviously true, since it is an aggregate model. Maybe I am incorrectly assuming that I should be able to sort aggregate models? Would it be easier to sort it using JS?

Best Answer

  • Rob Hatch
    Rob Hatch 🛠️ 
    Accepted Answer

    Please don't use JS. You need to put the full function and field name in the model sort property, instead of the alias.

    So if you are aggregating the SUM of Annual Revenue - your sort order statement on the model would be : "SUM(AnnualRevenue) Desc Nulls Last"

    If you are grouping by Created Date (Calendar Year) - your sort order statement would be: "CALENDAR_YEAR(CreatedDate) DESC"

    If you are grouping by a field - with no function - just use the salesforce field API name (rather than the aggregation alias).


    Skuid does have actions that do client side sorting. You can set those up to run on page load or on requery - but ideally you can get the sorting you need server side.

Answers

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!