Bug 118233 - ReportBuilder: filter setting function inconsistent in use of aliases when report based on nested query
Summary: ReportBuilder: filter setting function inconsistent in use of aliases when re...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.1.0.0.beta1+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Reports-Builder
  Show dependency treegraph
 
Reported: 2018-06-18 21:25 UTC by Gerhard Schaber
Modified: 2023-08-28 10:51 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample DB (9.56 KB, application/vnd.sun.xml.base)
2018-06-19 13:18 UTC, Gerhard Schaber
Details
screen shot showing issue (83.95 KB, image/jpeg)
2018-06-19 21:54 UTC, Drew Jensen
Details
hsql version of file (8.61 KB, application/vnd.oasis.opendocument.database)
2018-06-19 22:54 UTC, Drew Jensen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Schaber 2018-06-18 21:25:58 UTC
The report builder with Firebird uses the original column names instead of aliases. So when you use an alias in a filter of a report, it would not know it. This breaks the behavior known from HSQLDB.
Comment 1 Drew Jensen 2018-06-19 13:10:30 UTC
Using Ubuntu 18.04 w/ Libo 6.1 Beta2 I can't replicate your problem.

I create a view with column aliases and when I create a RB report against it the field picker displays the column aliases, sorting and grouping displays the column aliases and the sidebar property editor for fields does the same.

@Gerhard, do you have an example file you can share with the problem?
Comment 2 Gerhard Schaber 2018-06-19 13:18:12 UTC
In the attached example, the field picker shows the alias. When you select it, it will enter the original name of the view he current view is based upon.
Comment 3 Gerhard Schaber 2018-06-19 13:18:38 UTC
Created attachment 142915 [details]
Sample DB
Comment 4 Drew Jensen 2018-06-19 21:54:49 UTC
Created attachment 142941 [details]
screen shot showing issue

Got it:
Two QueryDefinitions; MitgliederVerbandExcelvorlage and Abfrage1. 

MitgliederVerbandExcelvorlage uses table MitgliederVerband

Abfrage1 uses MitgliederVerbandExcelvorlage and creates one alias, VereinID

Report is based on Abfrage1 and in the set filter dialog references Abfrage1.VereinID

But the filter SQL snippet references "MitgliederVerbandExcelvorlage"."Verien" instead of ( "Abfrage1"."VereinID" = '0' ) 

As far as I can tell it doesn't change the result set (didn't after I added some records and ran the report with both variations), but it seems it should the later and the not the former. 

Put it all in pictures(why not? ;) see attachment
Comment 5 Drew Jensen 2018-06-19 22:05:19 UTC
Changing summary to more closely match error
Comment 6 Drew Jensen 2018-06-19 22:54:23 UTC
Created attachment 142942 [details]
hsql version of file

Very same behavior with hsql based file (had to change the queries just a tad but otherwise identical DBs)

So, not just firebird, will update summary again.
Comment 7 Gerhard Schaber 2018-06-20 06:17:08 UTC
There is an essential difference between HSQLDB and Firebird. The HSQLDB version accepts a filter like ( "VereinsID" = 0 )

The Firebird version does not.

I created this ticket mainly because, that the Report Builder would not accept aliases in the filter and even pop up an error.
Comment 8 QA Administrators 2019-12-07 03:43:26 UTC Comment hidden (obsolete)
Comment 9 QA Administrators 2021-12-07 04:56:15 UTC Comment hidden (obsolete)
Comment 10 Gerhard Schaber 2021-12-07 09:10:31 UTC
It is the same with
Version: 7.2.4.1 (x64) / LibreOffice Community
Build ID: 27d75539669ac387bb498e35313b970b7fe9c4f9
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-AT (de_AT); UI: de-DE
Calc: threaded
Comment 11 Stéphane Guillou (stragu) 2023-08-09 12:08:52 UTC
In 7.2.7.2, I get the error message when using the alias in the report filter:

1. Edit Bericht1 report
2. In Data tab, Filter field, use:
( "MitgliederVerbandExcelvorlage"."VereinsID" = '0' )
3. Save and close, open the report

Result:
firebird sdbc_report error:
*Dynamic SQL Error
*SQL Error code =-206
*Column unknown

Using the filter dialog to change the field value works for other fields, but selecting the alias in the list does not.

Same in recent master build:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 42364fbfafaa95773c073cc080142b64ec1786fb
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Andreas, given that you fixed bug 132924, what do you think?
Comment 12 Andreas Heinisch 2023-08-28 10:51:22 UTC
Confirmed in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b3b926e32d81ff3bd6e065b986221382530c79a5
CPU threads: 16; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-AU (de_DE); UI: en-US
Calc: CL threaded

I will check why it uses the wrong table alias.