Thanks for all the input, what i ended up doing was using a search algorithm similiar 
to the Quick Sort algorithm... i'm not sure what its called, but i'm sure it has a 
name.  It runs extrememly effecciantly and i'm going to post some code if anyone else 
wants to use it.

requires a database sorted by the field you are searching for.

Int32
FindRec ( void *search )
{
        Int16 btm, mid, top, cmp;
        Boolean found = false;

        UInt16 TotalRecs = DmNumRecords ( gDb );

        btm = 0;
        top = TotalRecs;
                
        while ( found == false )
        {
                mid =  btm + ( ( top - btm ) / 2 );
                
                /* compare the search value, to one pulled from the record at index 
mid */
                cmp = CompareFunction ( search, mid );
                
                if ( cmp == 0 )
                        found = true;
                else if ( mid == btm || mid == top )
                        return -1;
                else if ( cmp > 0 )
                        btm = mid;
                else if ( cmp < 0 )
                        top = mid;
        }
        
        /* returns the index */
        return mid;
}

hope this helps you all out.

later,



Philip Streck
Akron General Medical Center
Information Systems


--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to