Page 1 of 1

[Solved]Freestanding form questions

Posted: Sat Dec 28, 2019 2:20 pm
by gkick
Hi ll,

How does one open a report based on a parameter query from a freestanding form?

And how does one run some sql statement from a freestanding form since base macros are not understood by writer

Thks

Re: freestanding form questions

Posted: Sat Dec 28, 2019 7:21 pm
by Villeroy
There are no Base macros. The API is exactly the same throughout all components.
MRI tells us how to open a report from within a database document:
SomeDatabaseDocument.ReportDocuments.getByName("MyReport").open()

Of course, ThisComponent does not refer to a database document if the code is embedded in a Writer document. You have to open the Base document with SomeDatabaseDocument=StarDesktop.loadComponentFromURL(...) or get the document containing the report from the registered data sources.

Re: freestanding form questions

Posted: Sat Dec 28, 2019 7:38 pm
by gkick
Thks, but I dont get it so the SomeDatabaseDocument.Rep... is the name of the db ? and the url will be the reportname ?

Re: freestanding form questions

Posted: Sat Dec 28, 2019 7:57 pm
by Villeroy
Too complex. Try [Writer] Stand-Alone Database Reports. As long as the row count remains in the hundreds, this could be an alternative solution. Most of my own reports are Calc documents with preformatted import ranges and/or pivot tables.

Re: freestanding form questions

Posted: Sat Dec 28, 2019 8:20 pm
by gkick
Thanks for that, will test, yet I think not a real alternative for some complex reports featuring rollups, subtotals, totals, averages etc..., so the old switchboard extension does not work (or I can not get it to work) and somehow I have to find a way to hide the database container.
Another weird thing (possibly memory related or gpu - calling a report from a form and the report prompting for parameters, then the parameter dialog pops in front, the calling form hides behind the dbcontainer. Once I close the report I stare at the container and then click the white rectangle in the taskbar to bring the form back up.