Wednesday, April 22, 2009

OOBasic Database Fun

1. F4 in Calc open up the database windows.

2. With ListBox,

SELECT DISTINCT "Name" FROM "Client"

SELECT "Name", "Address Line1", "Address Line2" FROM "Client" WHERE "Name"= 'Cash'

Listbox fun:
The Listbox in "Form" vs in "Dialog"
http://www.oooforum.org/forum/viewtopic.phtml?t=6552
"The LISTBOX in a FORM has different methods to the LISTBOX in a DIALOG."
Now who the hell would know about this?

(for Dialog) http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Basic/List_Box
(for Form) http://api.openoffice.org/docs/common/ref/com/sun/star/awt/UnoControlListBoxModel.html
http://codesnippets.services.openoffice.org/Database/Database.ChangeListboxSource.snip

Seems like a good complete example:
http://www.openoffice.org/servlets/ReadMsg?list=allcvs&msgNo=33507

Other stuffs:
Global scope variables must have "Global" as declaration, otherwise the value will be lost at end of Macro execution

i.e.

Global A as String
Dim B as String

Sub TestScope()
A = "Hello"
B = "World"
End Sub ' Once macro end, the B is "", A is still "Hello"

User declared type (Type ... End Type) has some ugly property need to take care of...
http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/Other_Instructions

http://ooomacros.org/

No comments: