Query changes when report run

Discuss the database features
Post Reply
iamoraal
Posts: 14
Joined: Sat May 15, 2010 12:10 am

Query changes when report run

Post by iamoraal »

I'm using a Calc spreadsheet as my data source. I created a query which sorts the data by last name(some may be empty). This query returns expected results when run on its own. But when I run a Report based on this query, the report is unsorted AND the query is altered (dropping the sort).
What would cause this to happen?
:: SQL ::

Code: Select all

SELECT "Full Name" AS "fname", "Home Address" AS "haddress", "City", "PC", "Email address" AS "email", "Cell Phone" AS "ph_cell", "Home Phone" AS "ph_home", "Last" FROM "Sheet1" WHERE "Full Name" <> '' ORDER BY "Last" ASC
OpenOffice 4.1 on Mac OS 10.9.5
Mountaineer
Posts: 336
Joined: Sun Sep 06, 2020 8:27 am

Re: query changes when report run

Post by Mountaineer »

First thing to check is if you requested sort/grouping inside the report. This may be conflicting - but I never tried spreadsheets as source for reports.
LibreOffice 7.6 on Windows 10pro and other Versions parallel
iamoraal
Posts: 14
Joined: Sat May 15, 2010 12:10 am

Re: Query changes when report run

Post by iamoraal »

@Mountaineer:: Thanks. But "conflicting sorts" is not the issue.
A spreadsheet is known as a "flat database". The data I had was already in spreadsheet form so that is what I used instead of making a relational database from scratch, although I may go that way anyways.
OpenOffice 4.1 on Mac OS 10.9.5
UnklDonald418
Volunteer
Posts: 1573
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Query changes when report run

Post by UnklDonald418 »

I've seen something like that happen when using the default Report Writer that comes with OO Base.
Install the Oracle Report Builder extension https://extensions.openoffice.org/en/pr ... rt-builder in most cases it works much better.
Several years ago,Libre Office ditched the old Report Writer and began using the ORB as the default.
 Edit: It appears that when using the legacy report writer it ignores the sort order of the query and if you don't specify the sort order in the report writer, it defaults to sorting on the primary key.  
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