View with parameters, the parser does not ask for parameters

Creating tables and queries
Post Reply
Hypno
Posts: 21
Joined: Tue Jun 14, 2022 12:47 pm

View with parameters, the parser does not ask for parameters

Post by Hypno »

I have such a question about table as view and parameters.
Namely, I have a view defined which is the final result of many complicated queries. To the definition of this view, I added two parameters in the "where" clause, limiting the date range of the resulting data from the bottom and from the top. Everything works as it should if I open the table means view in edit mode and then run it. The parser asks for parameters and everything is OK, but if I immediately run this view (double click on the view name) the parser does not ask for parameters and shows the result window without any data....
Did I miss any option or is this a design assumption or maybe a bug....?

View SQL content:

Code: Select all

 select ..... from ..... WHERE "v_wynik1"."data_pobytu" BETWEEN :DataStart AND :DataStop
As a curiosity I will say that this view behaves stupidly if I rename the parameters.
In this example, the conditions look like this:

Code: Select all

select ..... from ..... WHERE "v_wynik1"."data_pobytu" BETWEEN :DataOd AND :DataDo
The parser asks for both parameters (only from edit mode of course :-) ) but I get an empty result even though the parser doesn't report any error. It looks as if the names DateOd and DateDo are recognized as SQL keywords..... and in Polish they mean the phrases "Date From" and "Date To".
Anyway, it behaves similarly (meaning stupidly) if I want to modify these names by inserting the "_" sign between that is "Data_Od" and "Data_Do"
LibreOffice 7.2.2.1 (x64), Windows 10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: View with parameters, the parser does not ask for parameters

Post by Villeroy »

This is because Base's parser does not parse any view nor direct SQL queries. Direct SQL and views are parsed by the database engine itself.
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
Post Reply