I have two databases, customer database and a route delivery database (the route delivery database specifies the delivery day for each customer). I want to create a list screen that would list the customers for a specific delivery date (as selected by the user). My first thought was to just create a customer database with categories being the route day. Then I would use the category APIs to select and display the correct customers. (This mimics the catorgy proccessing in the palm Address and Memo applications). The problem is that a customer can have more than one delivery date, therefore it would be in multiple categories. This cannot be accomplished this way, is that correct??
What would be the proper way to do this? Would I need to sort my data by the delivery day field in the route delivery database and then sequentially read through the data looking for matches? (what would I use?) If I needed to do it this way, what what be the most efficient way to read the corresponding customer database? Would I need to do a callback function to compare the records? And would this whole process be efficient?
I come from a developement environment where records can be most efficiently accessed by a primary or alternate key. This seems to be closer to the concept of retrieving by category on the Palm. I want to ensure that I am approaching this problem correctly.
If you don't have a lot of records, it really doesn't matter how you do it b/c it will be fast enough just b/c of so few records.
I didn't really understand your question so here's some general advice.
If you have a lot of records, the easiest way is to keep the records sorted and use a binary search to find them. DmFindSortPosition() does this I believe, or you can write your own. This sorting can be done by multiple fields if it works for your app.
If you need to sort the entire dataset by multiple fields, you may need to have an index that keeps the same records sorted in a different order. This index needs only hold the data that is being sorted and the key field(s) from the main table.
Matt Graham Palm OS Developer, HealthRamp www.healthramp.com
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
