currentcontroller.getMaxRecordIndex() after find

After I do

currentcontroller.find()

I want to find out how many records in the find foundset but if I check

currentcontroller.getMaxRecordIndex()

it is always set to 1 untill the user moves to the second record in the find foundset and is then set to the right number. Is there a way I can get the right number immediately after the find is compleded?

Believe following came from Bob Cusick and always works fine for me:

globals.ct_recordsFoundDisplay = databaseManager.getFoundSetCount(forms[currentcontroller.getName()].foundset) + " records"

Servoy do warn that it is potentially ‘time expensive’ on large datasets but on < 100,000 records does not seem to make much diff.

Regards

Graham Greensall
Worxinfo Ltd

Actually that didn’t work any better than

currentcontroller.getMaxRecordIndex()

but I think my problem is not in the syntax, but in the event.

What happens is I do

currentcontroller.find()

and then the user enters the find criteria in the form and presses enter. By doing that, they execute a currentcontroller.search()

It is after the currentcontroller.search() that I need to check for the number of records, but I have been checking after the currentcontroller.find(). That is why I keep getting one record.

The problem is I don’t know how to capture the event that fires after a user presses enter in find mode. I have tried using the onFindCmd event but that doesn’t do it.

I use this for found sets that may return over 200 records after the search:

globals.Number2 = databaseManager.getFoundSetCount(foundset);

I use this for smaller found sets

globals.Number2 = forms.FlexQCServiceEstimate.controller.getMaxRecordIndex();

Hope this helps

OK, but that still doesn’t tell me how to capture the event that fires after a user presses enter in find mode.

Does anyone know?

So you are searching directly on your form, not using globals to search?

In this case I would guess that you would create a method to preform your search, and set it to run when you select the enter button.

There is no enter button.

The user presses a button and the form is placed in find mode. They they enter their search criteria into the form and press the enter key. That causes the find to do the search.

There MUST be some kind of event that fires when this occurs… isn’t there?

You can attach your search method to form elements or fields via the “on action” event.

Starting the search is not the problem. I am using the onAction event of a button for that. The problem is finding something that fires after the user presses enter to finish the find operation.

Anyway, it seems the onRecordSelection event fires, so I can attach my code to that.

Thanks for your help.

there is no event “after search”
we are planning to give an event: onSearch() that is right before we call search. So that you can alter the search and then do the real search.

But normally you can’t execute methods when in find mode. So we have this under investigation.