I want to work around the limitation of only showing 200 records at a time. In a form-view form, the user can’t tell how many records are there, anyway; they can view just one. But it will always show a found set of 200 initially (n =, say, 2000), and they KNOW that there are more… and so it looks “wrong”. When they get to record two hundred (using the button I provide), the number magically jumps to 400, etc. Again, looks “wrong” to the user.
What I wonder: since I am using a home-brew navigation area (similar to default controller), can’t I get the total number of possible records (i.e. the true, untruncated found set) and stuff it into the label that now shows the trucated found set number (i.e., 200, then 400, etc.)? I would think it would be easy as 3.14159265, but currentcontroller.getMaxRecordIndex() just seems to show the trucated found set number, and not the actual number of records available to the user.
Thank you, Harjo! That was just what I was looking for. And thanks to Bob Cusick, whose example is very useful and clear.
A question on the code that Bob provided:
var x = "Record " + currentcontroller.getSelectedIndex() + " of " + currentcontroller.getMaxRecordIndex()
x += " (" + databaseManager.getFoundSetCount(forms[currentcontroller.getName()].foundset) + " in foundset)"
globals.rec_display = x
which apparently could result in something like “Record 125 of 200 (5,000 in foundset)”:
Why might a user care how many records are cached (in a “record view”)? If they can only see the present record, and the number cached will bump up when they get to the next increment of 200, why wouldn’t “Record 125 of 5,000” do the job?
Perhaps in “list view”, it would make sense to alert the user that there are more records in the found set than are cached (if indeed n > 200); that would help explain the nonstandard effect on the scrollbar of having more records in the foundset than are cached.
Of course, it would be desirable also to try to limit the occurence of n > 200. In this respect, I am wondering about the usefulness of the “All” button I have on my forms. “Restore Last Find” (expressed more succinctly) might be more useful, but would require more programming overhead (date&time stamping?). Or maybe “Recent”, which would show the most recently modified records (presumably 200 or less!).
I think bob’s coding is just for the sake of this example. Nothing more.
Calculating your example however “Record 125 of 200 (5,000 in foundset)” can be very time consuming. Not really with 5.000 records but let’s assume it is 500.000 records.
I can imagine you or your user won’t care about any delay but there are certainly moments where you can’t afford such a delay…
IT2BE:
Calculating your example however “Record 125 of 200 (5,000 in foundset)” can be very time consuming. Not really with 5.000 records but let’s assume it is 500.000 records.
Did you actually tried that?
I tried it with a table of 1,2 million records, and could not notice any difference. So I don’t understand why Servoy is calling this function time-consuming!
Another thing I gathered from Bob’s example was a different way of getting the current form from the one I’ve been using. Is there an instance where one or the other may be preferable?
var curForm = application.getMethodTriggerFormName();
forms[curForm].elements.thislabel.text = maxRecord;
I tend to avoid the use of currentcontroller.
Currentcontroller is ok but only when you are working on the ‘main’ form. Working in a tabpanel doesn’t give you the name of the form with currentcontroller. To avoid mistakes I therefore don’t use it!
HJK:
Did you actually tried that?
I tried it with a table of 1,2 million records, and could not notice any difference. So I don’t understand why Servoy is calling this function time-consuming!
Your excuse is somewhat lame Bob, you should be ashamed of yourself! How dare you improving all the time. It is only a matter of time and we developers have no excuse for anything anymore
I tend to avoid the use of currentcontroller.
Currentcontroller is ok but only when you are working on the ‘main’ form. Working in a tabpanel doesn’t give you the name of the form with currentcontroller. To avoid mistakes I therefore don’t use it!