Grid - GroupBy change sorting

Hello,

I still have a sorting problem in a grid if I use group_by

1st - without grou by it looks fine

2nd - with group by the sorting is wrong

What did I wrong ?

Put ORDER BY datum in your SQL statement.

I did it and it works until I use the group by functionality
It looks that the group-by function remove or ignore the ORDER BY part from the SQL statement

Could you explain why do you have to use the group by funcionality? And yes, it breaks the original GROUP BY from your SQL statement.

I found it a missing feature too, you can set up sorting, which columns support it, but you cannot set up default sorting on grid open. sorting in the sql query is a work around but this is not shown in the grid headeaders (you like to show users the data is initially sorted by date)
there could be additional sorting options in the group by settings, logically grouping by on a different column than date leads to rondom sorting on the date field, just as this would be in a sql query , if you sort on a product, this will brake the sort on dates.
There is another consequence of group by settings, when you need it just for the summary, there is no way to turn it off in the detail data (initial views normally). May be somebody have found it?

I need a group reporting with the following level structure year / month / week
with a total line per level

I think Ifound a solution for my problem

I changed the SQL statement and add colums for the year, month, week and weekday and now at the moment it works

part of the SQL Statement:

DATE_FORMAT(Akt_Datum,’%Y’) as Akt_Datum_Jahr,
DATE_FORMAT(Akt_Datum,’%M’) as Akt_Datum_Monat,
DATE_FORMAT(Akt_Datum,’%u’) as Akt_Datum_Woche,
CASE DATE_FORMAT(Akt_Datum,’%w’)
WHEN 0 THEN ‘So’
WHEN 1 THEN ‘Mo’
WHEN 2 THEN ‘Di’
WHEN 3 THEN ‘Mi’
WHEN 4 THEN ‘Do’
WHEN 5 THEN ‘Fr’
WHEN 6 THEN ‘Sa’
ELSE ’ ’ END as Akt_Datum_WT,
Akt_Datum,

1 Like