LibreOffice Basic Open Form with Macro
The macro
Sub Dialog1Show
' References include
' http://stackoverflow.com/questions/27934551/open-a-form-in-libreoffice-openoffice-base-with-a-specific-filter-query
' https://ask.libreoffice.org/en/question/7555/open-form-via-macro-in-libreoffice-base/?answer=45607#post-id-45607
' https://help.libreoffice.org/Basic/Programming_Examples_for_Controls_in_the_Dialog_Editor
thisDoc = StarDesktop.CurrentComponent
'MsgBox thisDoc.dbg_properties
'MsgBox thisDoc.dbg_methods
thisForm = thisDoc.getdrawpage.getbyindex(2)
thisID = thisForm.getControl.Text
'MsgBox "using ID " & thisID
form_container = ThisDatabaseDocument.FormDocuments.getByName("EditContact")
form_container.open
form2 = form_container.component.getDrawPage.getforms.getbyindex(0)
form2.Filter =("ID = " & thisID)
End Sub
References
http://stackoverflow.com/questions/27934551/open-a-form-in-libreoffice- openoffice-base-with-a-specific-filter-query https://ask.libreoffice.org/en/question/7555/open-form-via-macro-in- libreoffice-base/?answer=45607#post-id-45607 https://help.libreoffice.org/Basic/Programming_Examples_for_Controls_in_the_Dialog_Editor
The story
In my migration to Linux on the desktop (yes, this is the year for me), I have started converting my Microsoft Access .accdb file to LibreOffice. In my interim I had a really cool jdbc connection, but now was the time to actually get off of that entirely. Using some instructions for the overly-simple task of exporting and importing data into LibreOffice Base, I got my little table saved to a .ods and then imported into a new, HyperSQL database. Oh my goodness, HyperSQL is not what I learned in my few database classes during college. I had to rewrite my mid-level-complexity query (the first time for the jdbc connection, and then again) for HyperSQL. Some user- unfriendly documentation exists.
- I swear somewhere I read said HyperSQL conforms to some standard, which I thought was http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt but half of the functions are "Disabled" according to LibreOffice error messages. Unfortunately LibreOffice Base and Basic error messages are extremely vague.
- http://hsqldb.org/doc/guide/builtinfunctions-chapt.html has better definitions, but even those, like COALESCE was "disabled."
In the function above, the MsgBox contents are debugging info that can provide you with method calls to duckduckgo to get examples and descriptions. In a future post I might share my "ContactsExtended" query I wrote a long time ago in Access 2010 and have ported up all the way to my current HyperSQL format.
Comments