Issue 79214 - RPT: Grouping records doesn't work right with sorted queries
Summary: RPT: Grouping records doesn't work right with sorted queries
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: recent-trunk
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.4
Assignee: christoph.lukasiak
QA Contact: issues@dba
Depends on:
Reported: 2007-07-04 14:08 UTC by Mechtilde
Modified: 2012-03-01 22:33 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

bugdoc database (225.47 KB, application/vnd.sun.xml.base)
2007-09-17 09:52 UTC, marc.neumann
no flags Details
this is the right bugdoc (49.78 KB, application/vnd.sun.xml.base)
2007-09-21 11:34 UTC, marc.neumann
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Mechtilde 2007-07-04 14:08:45 UTC
I want to group the records after parameters which are not a date.

It should combine all records with these parameters and several dates.
The result is that I get all records of one date with this parameters.
Comment 1 ocke.janssen 2007-07-20 12:58:05 UTC
Could you please add a sample. Thanks.
Comment 2 ocke.janssen 2007-07-20 13:23:23 UTC
Could you please add a sample. Thanks.
Comment 3 Mechtilde 2007-07-20 13:50:33 UTC
Here an example:

You have several accounts where you assign transactions from several dates.

I want to group to accounts. All transactions for one account should grouped not
looking for at the date.

the reality is that it groups only the transaktions of one date and do a new
group for another date.

Comment 4 ocke.janssen 2007-07-25 09:25:46 UTC
Do you have a sample database to try. I don't get what you are meaning. Sorry.
When you want to group accounts why you are not using the accounts? Just 
guessing. :-)
Comment 5 ocke.janssen 2007-08-01 10:07:44 UTC
change target
Comment 6 Mechtilde 2007-08-08 15:47:01 UTC
I tested it again:
If I sort date in the query then the reports works as described above

If I don't sort date in the query It seems that the report works as expected but
I can't sort date.

So in the second case the groupping is right but not the order of the rows.
Comment 7 marc.neumann 2007-09-17 09:52:52 UTC
Created attachment 48268 [details]
bugdoc database
Comment 8 marc.neumann 2007-09-17 09:56:36 UTC
- open the attached bugdoc database
- execute the report "order_product"
==>> the grouping is not correct
The problem is that the report based on a query which is sorted.
Comment 9 marc.neumann 2007-09-21 11:34:19 UTC
Created attachment 48392 [details]
this is the right bugdoc
Comment 10 ocke.janssen 2007-09-21 12:48:08 UTC
ORDER BY statements which are part of a query can not deleted and replaced by
the report order by statement, especially when thinking of the queries in
queries feature where it is not possible to figure out that there exists a ORDER
BY statement.

To sort for dates you have to insert a new (2nd) group without header after the
name. This should do what you aspect.
Comment 11 ocke.janssen 2007-09-21 12:49:10 UTC
Does the described way of creating a 2nd helps you?
Comment 12 Frank Schönheit 2007-09-21 20:44:03 UTC
Sorry, but that's not acceptable.

The user designs a report where s/he enters a query as data source, groups this,
and the result is mere nonsense which has no relation to the grouping the user
entered (aka: asked our application to respect): this certainly is not how our
product should behave.

We could
a) strip the order from the query's statement (it is halfway meaningless,
anyway, since the grouping implies another ordering)
b) append the query's ordering to the ordering which is implied by the grouping.
That is, if the query is ORDERed BY, say, "foo", and the report is grouped by
"bar", then the statement we use when executing the report should be ORDER BY
"bar", "foo".
In this case, the grouping would be correct, and the ordering *inside* a given
group block would be as described by the query.
c) prevent grouping when the query is ordered (which isn't a valid solution
until a) and b) are proven to not work).
Comment 13 Frank Schönheit 2007-09-21 20:45:51 UTC
fs->oj: please re-consider your decision, reasoning see above.
Comment 14 ocke.janssen 2007-10-02 11:31:47 UTC
If the source of a report is a query we have to check if it contains a order by
statement. If that is the case we need to cut it and append it after we append
the order by statement which is needed for the report.
It is not fixable when the query in query feature is used or a view with order
by is used. Only queries with order by statement can be handled correctly.
Comment 15 lars.langhans 2007-10-09 11:02:34 UTC
Comment 16 lars.langhans 2007-10-09 11:34:52 UTC
Comment 17 ocke.janssen 2007-10-23 09:45:01 UTC
Please verify. Thanks.
Comment 18 christoph.lukasiak 2007-10-31 13:39:10 UTC
verified in cws
Comment 19 Mechtilde 2008-02-01 19:46:39 UTC
in which CWS?
Comment 20 drewjensen.inbox 2008-03-15 04:42:21 UTC
Tested w/OOo 2.4 m_11, Kubuntu 7.1 64bit, SRB 1.0.2