At 17:39 2001/05/27 -0400, you wrote:
>But all the functions to retrieve a record from a DB seem to require the
>index of the record - how do I know what that is for the record I'm trying
>to get? It seems like the very first thing one must to do to be able to find
>the record is to get its index, but how do I do that? It must be something
>very simple, but I'm not seeing it.
You have to search for the record of interest using whatever matching 
criteria are relevant to your application. If the database is sorted (by 
your criteria), you can use a binary search (first find total record number 
with DmNumRecords) and then DmGetRecord or DmQueryRecord to inspect the 
records until you find the one you need. A linear search can also be 
accomplished with these routines.

For your application, a more intelligent approach might be to create the 
records for each tooth with one category and then a record for each patient 
in another category. Part of the patient record might be an array of 
indices (or if you will be sorting the database, deleting records, or 
otherwise changing the order of the records (and hence their index), store 
the unique ID of each tooth record) to the teeth records. Now you only have 
to search for the patient (DmQueryNextInCategory) and presto, you can get 
the teeth (with DmGetRecord or DmFindRecordByID).

Erik Blake
-------------------------------------------------------------------
Icefield Tools Corporation  tel: (867) 633-4264
3C Glacier Road             fax: (867) 633-4217
Whitehorse, Yukon CANADA    e-mail: [EMAIL PROTECTED]
Y1A 5S7                     internet: http://www.icefieldtools.com/


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