[Solved] The internal Base maxRow missing?

Discuss the database features

[Solved] The internal Base maxRow missing?

Postby arfgh » Thu Nov 07, 2019 9:20 am

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 | Windows 8.1 Enterprise x64 | Windows XP x64 SP2 | Java 1.8.0_231
arfgh
 
Posts: 492
Joined: Tue Mar 05, 2013 6:44 pm

Re: The internal Base maxRow messing ?

Postby UnklDonald418 » Fri Nov 08, 2019 9:50 pm

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.html
Using 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#IsRowCountFinal
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/common/ref/com/sun/star/sdbc/XResultSet.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.7 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1286
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: The internal Base maxRow missing?

Postby arfgh » Sat Nov 09, 2019 4:09 pm

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 | Windows 8.1 Enterprise x64 | Windows XP x64 SP2 | Java 1.8.0_231
arfgh
 
Posts: 492
Joined: Tue Mar 05, 2013 6:44 pm

Re: The internal Base maxRow missing?

Postby Villeroy » Sat Nov 09, 2019 4:32 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27700
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: The internal Base maxRow missing?

Postby F3K Total » Sat Nov 09, 2019 7:27 pm

If you mean the fetchsize of a structural form, try:
Code: Select all   Expand viewCollapse view
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
F3K Total
Volunteer
 
Posts: 950
Joined: Fri Dec 16, 2011 8:20 pm

Re: The internal Base maxRow missing?

Postby arfgh » Sun Nov 10, 2019 2:11 am

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 | Windows 8.1 Enterprise x64 | Windows XP x64 SP2 | Java 1.8.0_231
arfgh
 
Posts: 492
Joined: Tue Mar 05, 2013 6:44 pm

Re: The internal Base maxRow missing?

Postby F3K Total » Sun Nov 10, 2019 9:56 am

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
F3K Total
Volunteer
 
Posts: 950
Joined: Fri Dec 16, 2011 8:20 pm

Re: The internal Base maxRow missing?

Postby arfgh » Sun Nov 10, 2019 1:34 pm

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 | Windows 8.1 Enterprise x64 | Windows XP x64 SP2 | Java 1.8.0_231
arfgh
 
Posts: 492
Joined: Tue Mar 05, 2013 6:44 pm

The internal Base maxRow missing?

Postby arfgh » Sun Nov 10, 2019 2:49 pm

just some few details more..

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

Code: Select all   Expand viewCollapse view
   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   Expand viewCollapse view
   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 | Windows 8.1 Enterprise x64 | Windows XP x64 SP2 | Java 1.8.0_231
arfgh
 
Posts: 492
Joined: Tue Mar 05, 2013 6:44 pm


Return to Base

Who is online

Users browsing this forum: No registered users and 3 guests