Searching in a cursor

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Aug 8 22:18:19 CDT 2006


On 8/8/06 9:06 PM, "Carsten Friehe" <rblists at online.de> wrote:

Hi Carsten,
 
> I have a question regarding searching in a cursor. Maybe someone has an Idea.
> I have the following:

> A cursor which selects eg. 6000 rows (all messages in a newsgroup). This is
> sorted by Threads. This cursor is shown with Einhugurs great DataGrid (this
> is really great!).

> One record is selected and shown in the Messagewindow.

> Now the user wants to sort the cursor (newsgroup) by eg. the name of the
> sender. 

> So I change the where clause and get the result in the cursor.

> But how can I find the last selected record to jump to this record and
> display it selected inside the DataGrid?

> Is the only possibility I have to recognize the rowid and search it in the
> new cursor, record by record?

> Or is there another great possibility to find that record in no time?

You sort new cursor by name.

So you can do fast search ONLY by this field.
As fast search I mean BINARY SEARCH.

So I recommend try next:

    you need remember in your current record
    field name value AND its RecID.

In new cursor you do binary search of this name.
This is fast. 20 jumps for 1000 records. 30 jumps for million records.

May happens that you will find few records with the same name.
Then INSIDE of this small group you do linear search by RecID

 
> I am using V4RB 1.11 because I didn't had the time to change everything to
> V4RB 2.x.

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list