Display query result in a subform table

Creating tables and queries

Display query result in a subform table

Postby sil3ntpi » Tue May 16, 2017 11:53 am

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   Expand viewCollapse view
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   Expand viewCollapse view

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!!

LibreOffice 5.2 on Arch Linux 4.10.13
Posts: 1
Joined: Tue May 16, 2017 11:36 am

Re: display query result in a subform table

Postby eremmel » Tue May 16, 2017 2:01 pm

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.
Is your question answered: edit your initial post add "[Solved]" to the subject and check V
LO4.2.8 for work with ORB; AOO4.1.4,LO5.2.5/6.0.5 on W7E SP1 64bit
It's Microsoft marketing that tells you computers are qualified for non-technicians
User avatar
Posts: 1026
Joined: Tue Dec 30, 2008 1:15 am
Location: Barneveld, Netherlands

Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 1 guest