[Solved] The internal Base maxRow missing?

Discuss the database features
Post Reply
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

[Solved] The internal Base maxRow missing?

Post by arfgh »

hey there friends.
I want to know if somebody knows how to programmatically detect and change the max row that Base have from loading, that are 40 rows.
Yo know when we read the row number 40, and navigate to the 41, base drive us into blank insert Row.

Of course i am looking for a way to detect that, like for example 'if form.isLast', and then force base to load other 40 records or some.

And also... of course i know the trick to do form.last, form.first. But i want to know other possible way to do it, not that trick.

Some ideas ?
Last edited by arfgh on Sun Nov 10, 2019 2:51 pm, edited 3 times in total.
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: The internal Base maxRow messing ?

Post by UnklDonald418 »

There is no place where the number of rows in a database table are stored. A query like

Code: Select all

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/com ... owSet.html
Using the MRI tool, inspect your form and it will have a property IsRowCountFinal.
https://www.openoffice.org/api/docs/com ... CountFinal
The 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/comm ... ltSet.html
In 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.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: The internal Base maxRow missing?

Post by arfgh »

so UnklDonald418, isnt there a way that allow us programmatically to extend that 40 rows by default 'preloaded' by base ?
my idea was to extend other 40 when reaching the row number 40....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: The internal Base maxRow missing?

Post by Villeroy »

Why so complicated? download/file.php?id=24806
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: The internal Base maxRow missing?

Post by F3K Total »

If you mean the fetchsize of a structural form, try:

Code: Select all

Thiscomponent.DrawPage.Forms.MainForm.FetchSize = 500
to increase from 48 to 500
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: The internal Base maxRow missing?

Post by arfgh »

but... i tried before to alter the 'FetchSize' and the preloaded rowcount keeps on 40 and by the way, reaching row 40 and navigating to row 41 caused empty records.... I will test it again but i am sure that i did that test....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: The internal Base maxRow missing?

Post by F3K Total »

you have to run the code in EDIT-Mode of the form, then save form and .odb, retry...
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: The internal Base maxRow missing?

Post by arfgh »

worked !!
i dont know why, but the first time i figured that the property FetchSize may be involved and i altered it, i obtained the same 40 rows as always... But now works fine...

Thx so much guys for the help :)
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

The internal Base maxRow missing?

Post by arfgh »

just some few details more..

this way is extremelly low, 800 rows, but works fine.

Code: Select all

	res = executeSQL(" SELECT COUNT (*)  FROM ""table"" ")
	res.next()
	form.fetchSize = res.getString(1)
This way works faster, but has the collateral effect calling events 'registry data change', 2 in fact.

Code: Select all

	form.last
	form.first
so none of them are perfect, but with a big of control they can be used as expected...
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Post Reply