Reports Aren't Sorting Correctly

Creating tables and queries
Post Reply
DatabaseNewbie
Posts: 6
Joined: Sat Jan 07, 2023 5:12 am

Reports Aren't Sorting Correctly

Post by DatabaseNewbie »

I have a query that is sorted according to Course Major, Last Name, and then First Name. I'm trying to produce a report utilizing this same sorting (which would put Biology first).

Wizard let me choose Major as the first sort, followed by Last Name and First Name. However, when I finish the report, it only sorts it by Last Name. The Majors are not in order (History is first).

I tried to find an option to do it in SQL view, but I don't even see a button for that.

Does anyone know how to troubleshoot this?
OpenOffice Version 4 on Mac Ventura
erbsenzahl
Volunteer
Posts: 255
Joined: Tue Apr 18, 2017 8:23 am
Location: Germany

Post by erbsenzahl »

I used the built-in database biblio and made a query using sorting (wizard). In SQL view I get this:

Code: Select all

SELECT "biblio"."Author" "Author", "biblio"."Booktitle" "Booktitle", "biblio"."Publisher" "Publisher" FROM "biblio" "biblio" ORDER BY "Author", "Booktitle", "Publisher"
ORDER BY. Can this help?
LibreOffice current versions 7 and OpenOffice 4.1.15
on LinuxMint 20 - 21 Mate, W10-64 pro
DatabaseNewbie
Posts: 6
Joined: Sat Jan 07, 2023 5:12 am

Re: Reports Aren't Sorting Correctly

Post by DatabaseNewbie »

So, I am already using the ORDER BY function for my query. My problem is that when I generate a report and use sorting, the report does not reflect the sorting requirements I placed on it.

The report results should be sorted in the same order as my query, but they're not.
OpenOffice Version 4 on Mac Ventura
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Reports Aren't Sorting Correctly

Post by Villeroy »

What makes you believe that anything is not sorted properly?
Is it not sorted at all? (compared to the source table)
Is ist sorted in strange ways? (alphabetically instead of numeric sort order)
Do you know how to create a query with sorting and then create a report based on that query? (opposed to reporting a table)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
DatabaseNewbie
Posts: 6
Joined: Sat Jan 07, 2023 5:12 am

Re: Reports Aren't Sorting Correctly

Post by DatabaseNewbie »

Yes, my query is sorted just fine (Majors are in alphabetical order), but my report results are not. I chose the first sorting type to be by Major, but it's not sorting them alphabetically when I finish the report.
OpenOffice Version 4 on Mac Ventura
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Reports Aren't Sorting Correctly

Post by Villeroy »

First of all, which type of database are we talking about? What is the text displayed in the status bar of your Base window? See also menu:Edit>Database>Properties...

Right-click the icon of the correctly sorted query, choose "Report wizard" and create a quick and dirty 2-click report. Ist this report sorted properly?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
DatabaseNewbie
Posts: 6
Joined: Sat Jan 07, 2023 5:12 am

Re: Reports Aren't Sorting Correctly

Post by DatabaseNewbie »

It is a simple database I created with only 3 tables, 3 queries, and 1 report. According to the properties, it's embedded. Hopefully, this is the info you are needing.

No, even when I use the Report Wizard, it does not sort it in alphabetical order by Major, even though that's the option I choose as my first sort. I've tried sorting in both ascending and descending order, but it keeps sorting the same. It seems to be completely ignoring the Major sort and moving right on to the Last name sort. I even tried sorting only by Major, but again it doesn't put them in alphabetical order.
OpenOffice Version 4 on Mac Ventura
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Reports Aren't Sorting Correctly

Post by UnklDonald418 »

I too have experienced sorting issues with the OO report writer when using a query as the data source.
Right click on your query and select the Create as View option. A view makes the query look like a table to the Base front end.
Using the view as a data source and not specifying any sorting in the report, it should print in the order specified in the query.

A better solution is to download and install the Oracle Report Builder Extension.
https://extensions.openoffice.org/en/pr ... rt-builder
It will print correctly using the query as a data source.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Post Reply