This method:
currentcontroller.recordIndex = currentcontroller.maxRecordIndex
isn’t working anymore! Also in the CRMdemo it isn’t function anymore.
am I doing something wrong?
This method:
currentcontroller.recordIndex = currentcontroller.maxRecordIndex
isn’t working anymore! Also in the CRMdemo it isn’t function anymore.
am I doing something wrong?
This is old syntax that shouldn’t be there in the CRM.
Proper syntax:
currentcontroller.recordIndex = currentcontroller.getMaxRecordIndex()
Oke, that’s fixed.
but it still does’nt work all the time.
If i open the solution, it works (it goes to the last record) but after I click a field label (sorting!) and my list is sorted, it won’t go to the last record! (total of 10.000 records!)
Why don’t you do an invert sort if you want to go to the last record? In some desktop databases it is very common to go with one click to the last record as all data is always local.In SQL based backends this is not very common and depending on your foundset it can be very expensive. Servoy will by default get the first 200 rows as you might have noticed in the controller. Servoy simply doesnt know what your last record is, you could know by performing a count (servoy even has a function for that) but that can be an expensive operation depending on your amount of data. If you still want to go to your last record anyhow you can do:
while (controller.recordIndex < controller.getMaxRecordIndex())
{
controller.recordIndex = controller.getMaxRecordIndex();
}
The above isnt a problem if you have 10k rows but I wouldnt recommend it in large tables. It also undermines the true client/server concept of Servoy.
I still recommend the inverse sorting to go to the last record as then you leave the sorting to be done by the backend SQL server that has been optimized to perform this kind of operations.
Oke thanks!
That makes it clear!
I haven’t tried this yet but here’s my knee-jerk thought:
Have Servoy or the backend automatically increment a seperate table every time records are added or deleted. Place the appropriate dataprovider on the form and you would have a live total row count at all times. As I said - I haven’t tried this but it sounds like a good solution.
…row_count
employee…48
invoices…100002
payments…79000
customers…590
Add another payment:
…row_count
employee…48
invoices…100002
payments…79001
customers…590
My current end users feel secure seeing the total number of records at all times because they are used to it.
I appreciate any thoughts on this.
Good idea, downside is that you if you add/delete records outside of Servoy it wouldnt reflect a correct count. Also this solution will only work for counts of complete tables what if somebody does a find and has a large foundset.
In many cases you can simply use the count functions Servoy provides:
getTableCount for an entire count and
getFoundSetCount for the foundset
Just make sure you don’t use them on very large tables or buy a very big databaseserver
You could also consider maintaining rowcounts using a trigger on your backend database.