There is no place where the number of rows in a database table are stored. A query like
- Code: Select all Expand viewCollapse view
SELECT COUNT (*) FROM "SomeTableName"
will tell the database engine to calculate and report the number of rows in a table, but the database engine doesn't store that value anywhere.
Base forms use the
RowSet Service to supply data to a form.
https://www.openoffice.org/api/docs/common/ref/com/sun/star/sdbc/RowSet.htmlUsing the MRI tool, inspect your form and it will have a property
IsRowCountFinal.
https://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/ContentResultSet.html#IsRowCountFinalThe documentation indicates the value for that property remains FALSE until all of the rows in the database table have been loaded into the Base form.
The most expedient way to force
IsRowCountFinal to display TRUE is to execute the method
last(). For a list of all the navigation methods inherited from the
ResultSet Service see
http://www.openoffice.org/api/docs/common/ref/com/sun/star/sdbc/XResultSet.htmlIn my tests, if a table control has 18 or fewer rows then the initial
RowCount is 40, but if I resize it to hold 19 rows then the initial RowCount is 42 and with 24 lines it is 50. By increasing the number of rows on a table control to 80, the initial RowCount was 164.
If it is too much trouble for the user to use the "trick", I suppose you could write a macro that when loading a form would execute the method
last() followed by
first() so that
IsRowCountFinal will be TRUE and
RowCount will initially display the total number of rows in the table.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.8 & LibreOffice 6.4.7.2 - Windows 10 Professional