Display query result in a subform table

Creating tables and queries
Post Reply
sil3ntpi
Posts: 1
Joined: Tue May 16, 2017 11:36 am

Display query result in a subform table

Post by sil3ntpi »

Hi at all,

I'm using libreOffice Base as a graphical frontend to PostgreSQL database. Within the PSQL database is a self-written function, 'search(parameter1, parameter2)', which returns a table. I now want to have a form with two input textfields, a button and a table (grid). The content of the input textfields should be used as the parameters for the PSQL function 'search' and on button press, I want to display the result of that function in the table.
So far I am able to read the values from the textfields in a macro with something like

Code: Select all

parameter1 = oForm.getByName('InputPara1').Text
parameter2 = oForm.getByName('InputPara2').Text
I also already have a Basic function, which handles the SQL query and returns the result of

Code: Select all

oSQL_Statement.executeQuery
And here is where I'm stuck, I can't figure out how to display this result in the table. Any help/suggestions? Thanks in advance!!

Greetings
LibreOffice 5.2 on Arch Linux 4.10.13
eremmel
Posts: 1080
Joined: Tue Dec 30, 2008 1:15 am

Re: display query result in a subform table

Post by eremmel »

Why not using a view to access your function result. Just follow the filter-pattern: filter fields in main form, result in sub-form.
The filter fields are stored in a table and picked up by the sub-form -> and used in your view.
You might need so something special for multi user access on the filter table like current-user or current-session/connection.
You get now the form-layout for free because base can analyze the result set of the query.
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
Post Reply