Tip/fix: Query grouping + Sorting

Contains tips for configurators working with Aware IM
Post Reply
hpl123
Posts: 2633
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Tip/fix: Query grouping + Sorting

Post by hpl123 »

Hi all,
Here is a tip to fix the bug with sorting not working in queries if you use grouping (i.e. if you use grouping and group data based on some attribute e.g. category, the sorting is not respected so no matter what you configure in the configtool etc. the sorting doesn´t work):
Add the following to the queries advanced (init) script and the field parameter is the sorting you want to use:

Code: Select all

var ds = config.dataSource;
ds.serverSorting=false;
ds.sort = {field: "PriorityScoreTemp", dir: "desc"};
Henrik (V8 Developer Ed. - Windows)
PointsWell
Posts: 1473
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Tip/fix: Query grouping + Sorting

Post by PointsWell »

Should this work with shortcut fields?

I have a query that is grouped on a category name (sc_Status) but I want to sort on sc_StatusCode to override the alphabetic sort of sc_Status, but when I put the following into initialisation it still sorts by the Grouping

Code: Select all

var ds = config.dataSource;
ds.serverSorting=false;
ds.sort = {field: "sc_StatusCode", dir: "asc"};
hpl123
Posts: 2633
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Tip/fix: Query grouping + Sorting

Post by hpl123 »

Not sure but think it should work for shortcuts as well, try it with regular attributes and see if that works (and if that works but not the shortcut then I guess it´s something special with the shortcuts).
Henrik (V8 Developer Ed. - Windows)
rprinzing
Posts: 5
Joined: Tue Nov 14, 2017 12:27 am
Location: Kansas City, KS

Re: Tip/fix: Query grouping + Sorting

Post by rprinzing »

YES! That works.
However, what does the syntax need to look like if the sort is MORE than one field?
I need to sort by TimeAppointment, NameFirst.
Certainly hope future versions address this bug. Plus ONE.
Thanks!!!!
Warm Regards,
Robin
_____________________________________
AwareIM 8.4 (build 2721) MS SQL Server 2014 / MySQL , Windows 10, Theme: Default, Browser: Chrome
johntalbott
Posts: 620
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Tip/fix: Query grouping + Sorting

Post by johntalbott »

Code: Select all

ds.sort = [{ field: "TimeAppointment", dir: "desc" }, { field: "NameFirst", dir: "asc" }]
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Post Reply