Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15

API

SDK

Tips ‘n’ Tricks

Miscellaneous


:: com :: sun :: star :: form :: component ::

service DatabaseListBox
Description
This service specifies a data-aware list box control model.

The base service for list boxes (ListBox) offers only one possibility to specify the list entries: the ListBox::ListSource property, which contains all the strings to be displayed.

This service here extends this mimic. It allows to fill the list from a data source. This means that a second result set is opened, which works on the same connection as the form which the list box belongs to, but can be based on an arbitrary table or SQL statement.

For instance, you may have a form which is bound to a table invoice, and you use it to enter invoices for your customers. Probably, you will have a second table (say customer), which (amonst other data) contains a unique key for identifying customers. In your invoice table, you will have a foreign key referring to these customers.
Now, besides the result set the form is based on (all your invoices), the list box can be caused to open a second result set, this time for the customer table, and fill it's list with entries from this result set.
Additionally, it allows to model the relation between the two tables: When the user selects a customer from the list, this customer has the unique id we just talked about (which is not necessarily visible to the user in any way). The list box then automatically transfers this id into the foreign key column of invoice, thus allowing the user to transparently work with human-readable strings instead of pure numbers.
Let's call this result set the list is filled from the list result set here ...


Included Services - Summary
ListBox
(referenced entity's summary:)
specifies a model for a control which allows to choose in a list of alternative values.
::com::sun::star::form::DataAwareControlModel
(referenced entity's summary:)
is an abstract service for specialized ::com::sun::star::form::FormControlModels which are data aware and thus can be bound to a data source.
Properties' Summary
short
BoundColumn
specifies which column of the list result set should be used for data exchange.  
::com::sun::star::form::ListSourceType
ListSourceType
describes the kind of list source used.  
Included Services - Details
ListBox
(referenced entity's summary:)
specifies a model for a control which allows to choose in a list of alternative values.
::com::sun::star::form::DataAwareControlModel
(referenced entity's summary:)
is an abstract service for specialized ::com::sun::star::form::FormControlModels which are data aware and thus can be bound to a data source.
Properties' Details
BoundColumn
short BoundColumn;
Description
specifies which column of the list result set should be used for data exchange.

When you make a selection from a list box, the "BoundColumn" property reflects which column value of a result set should be used as the value of the component. If the control is bound to a database field, the column value is stored in the database field identified by the property ::com::sun::star::form::DataAwareControlModel::DataField.

0
The selected (displayed) list box string is stored in the current database field.
1 or greater
The column value of the result set at the position is stored in the current database field.

The bound column property is only used if a list source is defined and the list source matches with the types ::com::sun::star::form::ListSourceType::TABLE, ::com::sun::star::form::ListSourceType::QUERY, ::com::sun::star::form::ListSourceType::SQL or ::com::sun::star::form::ListSourceType::SQLPASSTHROUGH. Otherwise the property is ignored, as there is no result set from which to get the column values.

ListSourceType
::com::sun::star::form::ListSourceType ListSourceType;
Description
describes the kind of list source used.

Depending on the value of this property, the way the value of ListBox::ListSource is evaluated varies.

::com::sun::star::form::ListSourceType::VALUELIST
The elements in the string sequence in ListBox::ListSource build up the entry list.
::com::sun::star::form::ListSourceType::TABLE
The first element of the string sequence in ListBox::ListSource determines the table which the list result set should be based on.
::com::sun::star::form::ListSourceType::QUERY
The first element of the string sequence in ListBox::ListSource determines the query which the list result set should be based on.
For retrieving the query, the connection which the data form is working with (::com::sun::star::sdb::RowSet::ActiveConnection) is queried for the ::com::sun::star::sdb::XQueriesSupplier interface.
::com::sun::star::form::ListSourceType::SQL
The first element of the string sequence in ListBox::ListSource contains the SQL statement which the list result set should be based on.

::com::sun::star::form::ListSourceType::SQLPASSTHROUGH
The first element of the string sequence in ListBox::ListSource contains the SQL statement which the list result set should be based on.
The statement is not analyzed by the parser. This means that you can use database specific SQL features here, but, on the other hand, loose features like parameter value substitution.
::com::sun::star::form::ListSourceType::TABLEFIELDS
The first element of the string sequence in ListBox::ListSource determines the table which's column names should fill the list.


 
Top of Page

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.