Step 1 (empty database)
Step 2 create the records A,B,C (category 1) and A1, B1, C1 (category 2).
Step 3 Call DmInsertionSort
Step 4 Examine Records:
    A
    B
    C
    A1
    B1
    C1

Sorted Correctly (Sorted by Category, then Value).

Step 5 - Change B1 to B2...ChangeRecord calles DmFindSortPosition for 
the new Record B2.  I expect that this routine should return 5 (C1) so I 
can insert the record after before C1 (Insert into position 4=(5-1) by 
changing the position of the record 4 to record 4 (B1 changes to B2 but 
should remain in the same position)). However, the function returns 2. 
 The only thing I can figure is that it's the second position in the 
category,  So, the "Insert into Position" isn't working.

Either this function isn't returning the correct value, or I'm not using 
it correctly...I don't know which is the case.  The normal inserts (into 
position) don't work either.   But sorting does work.

James


Brian Smith wrote:

>One question... are you inserting the initial data in, then updating the
>records (changing the sort key, and therefore the sort order), or are you
>inserting new data into an empty database for each test?
>
>If it's the latter, then DmFindSortPosition should be working.
>
>If it's the former, and you're expecting the records to remain correctly
>sorted after you change them... uh uh... nope... not gonna work.  Look
>into DmInsertionSort or DmQuickSort (better for large databases), and call
>one of those with your compare function after you change the record(s). 
>That will re-sort them according to your compare function.  I do the same
>thing in one of my apps, and it works like a charm. 
>
>----------------------------------------------------------------------
>Brian Smith  //   [EMAIL PROTECTED]   //  http://www.arthurian.nu/
>Software Developer  //  Gamer  //  Webmaster  //  System Administrator
>   "When you understand UNIX, you will understand the world.
>    When you understand NT....you will understand NT" - R. Thieme
>
>



-- 
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