Bug 134049 - EDITING In the base query designer I would like to be able to request it to parse down the criterion of a column
Summary: EDITING In the base query designer I would like to be able to request it to p...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-16 21:14 UTC by tj_trevor.jones
Modified: 2020-07-08 10:06 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Screen shot of proposed query (26.35 KB, image/png)
2020-06-16 21:16 UTC, tj_trevor.jones
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tj_trevor.jones 2020-06-16 21:14:36 UTC
Description:
I would like to be able to generate a query like the following :-

SELECT * FROM "Table1" 
WHERE ( "FieldA" = :AskA  OR "FieldA" IS NULL) AND 
       ("FieldB" = :AskB  OR "FieldB" IS NULL )

This could be by the use of brackets (as in the SQL)or some marker in the column


Steps to Reproduce:
1.Click on Query
2.Click on Query in Design View
3.Enter as per attached screen shot
4.Click on switch design view on/off 

Actual Results:
It's an enhancement request.

Expected Results:
SELECT * FROM "Table1" 
WHERE ( "FieldA" = :AskA  OR "FieldA" IS NULL) AND 
       ("FieldB" = :AskB  OR "FieldB" IS NULL )


Reproducible: Always


User Profile Reset: No



Additional Info:
After encountering the end bracket continue parsing at the row of the open bracket and the column to the right of it.
Comment 1 tj_trevor.jones 2020-06-16 21:16:02 UTC
Created attachment 162074 [details]
Screen shot of proposed query
Comment 2 Alex Thurgood 2020-07-01 07:11:31 UTC
@Trevor: 

Does this work in the way you want if you remove the parameterized part of the query and replace it with a value to search for directly against the field ?

Does your query work in the SQL direct edit mode (I'm assuming/hoping it does) ?

If it works in these situations, then the problem would appear to lie in correctly parsing the parameterized query aspect within the UI.
Comment 3 tj_trevor.jones 2020-07-01 16:58:06 UTC
The query works in SQL direct edit.

Using values rather than parameters gives the following

SELECT "Table1".*, "Table1"."Field1A", "Table1"."Field1B" FROM "Table1" 
WHERE ( "Field1A" = '101A' AND "Field1B" = '105B' OR "Field1A" IS NULL AND "Field1B" IS NULL )

This is not what I was hoping to find.
Comment 4 QA Administrators 2020-07-02 03:38:30 UTC Comment hidden (obsolete)
Comment 5 Alex Thurgood 2020-07-07 17:12:39 UTC
@Treveor : isn't this a DUP of the other bug reports you filed
Comment 6 tj_trevor.jones 2020-07-07 18:30:26 UTC
Yes, sorry. I should have changed the status when I did the other one.
Comment 7 Robert Großkopf 2020-07-08 10:06:33 UTC
This is a feature request.

The GUI couldn't create such a code. It creates a code like
SELECT * FROM "Table1" 
WHERE "FieldA" = :AskA AND "FieldB" = :AskB
      OR "FieldA" = :AskA AND "FieldB" = IS NULL
      OR "FieldA" IS NULL AND "FieldB" = :AskB
      OR "FieldA" IS NULL AND "FieldB" = IS NULL

With this code nearly the whole possible rows for criteria in the designer will be blocked. Adding a third field will be impossible in the designer.

SELECT * FROM "Table1" 
WHERE ( "FieldA" = :AskA  OR "FieldA" IS NULL) AND 
       ("FieldB" = :AskB  OR "FieldB" IS NULL )
This all works well without the GUI. The query doesn't need to be switched to direct SQL. You could input data ...

I could confirm the behavior of the GUI. Would be a good idea to let the user decide if he wants to set the columns of the query-GUI in brackets. At this moment the GUI looks first for the rows, adds all content with "AND" and then adds the next row with "OR".

This behavior exists since the beginning of LO, so I set the version to "Inherited from OOo"