Difference between revisions of "Documentation/DevGuide/Forms/Filtering and Sorting"
m |
OOoWikiBot (Talk | contribs) m (Robot: Changing Category:Forms) |
||
Line 32: | Line 32: | ||
{{PDL1}} | {{PDL1}} | ||
− | [[Category: Forms]] | + | |
+ | [[Category:Documentation/Developers Guide/Forms]] |
Revision as of 08:28, 4 June 2008
- Forms as Row Sets
- Loadable Forms
- Sub Forms
- Filtering and Sorting
- Parameters
Forms support quick and easy filtering and sorting like the underlying row sets. For this, the properties <idlml>com.sun.star.sdb.RowSet:Filter</idlml>, <idlml>com.sun.star.sdb.RowSet:ApplyFilter</idlml> and <idlml>com.sun.star.sdb.RowSet:Order</idlml> area used.
// set this as filter on the form String sCompleteFilter = ""; if ((null != sOdbcDate) && (0 != sOdbcDate.length())) { sCompleteFilter = "SALEDATE >= "; sCompleteFilter += sOdbcDate; } m_xSalesForm.setPropertyValue("Filter", sCompleteFilter); m_xSalesForm.setPropertyValue("ApplyFilter", new Boolean(true)); // and reload the form XLoadable xLoad = (XLoadable)UnoRuntime.queryInterface(XLoadable.class, m_xSalesForm); xLoad.reload();
In this fragment, a filter string is built first. The "SALEDATE >= {D '2002-12-02'}
" is an example for a filter string. In general, everything that appears after the WHERE clause of an SQL statement is set as a Filter
property value. The same holds true for the Order
property value and an ORDER BY
clause.
Then the ApplyFilter
property is set to true
. This is for safety, because the value of this property is unknown when creating a new form. Every time you have a form or row set, and you want to change the filter, remember to set the ApplyFilter
property at least once. Afterwards, reload()
is called.
In general, ApplyFilter
allows the user of a row set to enable or disable the current filter quickly without remembering it. To see what the effects of the current filter are, set ApplyFilter
to false
and reload the form.
Content on this page is licensed under the Public Documentation License (PDL). |