OK Palm Guru's....please tell me how to insert in order....here's the
problem.
Record Index Value Category
0 A 1
1 B 1
2 C 1
3 D 2
4 E 2
5 F 2
When I display records in a list and display category 2 I get the following
Record Index Value Category
3 D 2
4 E 2
5 F 2
Displays perfectly. Now, let's CHANGE E to, say, E1. Should still
remain at index 4
Executing the command:
Position = DmFindSortPosition (dbP, dataP, newRecordInfo, (DmComparF *)
DmCompareRecords, null);
Returns a 1. This is "theoretically" correct. Since it is in the
second position in category 2.
Currently, I'm using this value unaltered, which results in the list:
Record Index Value Category
0 A 1
1 E 2
2 B 1
3 C 1
4 D 2
5 F 2
Which is now incorrect. When I display category 2, the values are out
of order
Record Index Value Category
1 E 2
4 D 2
5 F 2
I have to admit that I am VERY VERY VERY confused as to when the API
documentation
uses the term Index to either mean "position in category" or "database
index" and
when and how I'm supposed to know what the API call is returning.
If someone tells me that..."hey, you're SUPPOSE to add the dbindex of
the first record in the current category to the value returned from
DmFindSortPostion" then I'll say, OK, I'll do that. But really...is
that "really" suppose to be the way you do this?
By the way, I'm pretty confident that my callback routine
DmCompareRecords is working properly. If I resort these records, the
order comes out correctly. Also, the sort order is "Category, Value"
such that categories are always "kept together". If this is a wrong
approach, let me know. For example, a complete sort of my database might
look like
Record Index Value Category
0 A 1
1 B 1
2 C 1
3 A1 2
4 B1 2
5 C1 2
HERE'S ONE STRAIGHT FROM THE DOCUMENTATION!!!!!!! PLEASE READ BELOW
Page 525 of the Palm OS SDK Reference Guide for the function
DmQueryNextInCategory
in brief it says do the following:
Definition:
DmQueryNextRecordInCategory(DmOpenRef dbP, UInt16 *indexP, UInt16
Category);
where in quote "indexP - Often retrieved with DmPositionInCategory"
Code Snipit example:
pos = DmPositionInCategory(myDB, record, category);
pos++;
newRecH = DmQueryNextRecordInCategory(myDB, &pos, category);
If using the above table set record = 4 (Value B1)
Call DmPositionInCategory will return a 1 (second position in category 2)
pos++ sets position=2;
newRecH on DmQueryNextRecordInCategory() would then point to record
Value C.
What I wanted was record C1 Index 5 not index 2.
Why on EARTH is DmPositionInCategory ever used to return the "Index" for
use in DmQueryNextRecordInCategory.
I can't see when this will EVER work.
Help Please! Before I go crazy.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/