BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 11-20-2008, 03:57 AM   #1 (permalink)
New Member
Join Date: Nov 2008
Model: 8330
Carrier: Sprint
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Using RecordStore for options database

Please Login to Remove!

Greetings all,
After having wrapped my head around RecordStore (I think) I've decided it's (finally) time to implement options in my educational (for me not the user) program. Primarily I want to know if the method I intend to use is optimal, I'm not looking for code, once I come up with the procedure I'm pretty sure I can handle that. I'm having difficulties figuring out how to say what I am intending to do, so I'll try explaining through example.

Let's say my program has three options. At Program start it will open a RecordStore (and create if neccessarry) and see if it has any options set, if it does they will be read to appropriate variables, and if not it will asign default values, and save these defaults to the recordstore.

That seems a fairly simple thing to do, check the size of the record store, and if it's 0 then it's empty, and proceed to set the options.

When the User goes to set the options, we asume the exist in the recordstore (as it shouldn't be possible to get to this point without having set them), so we read them in and set the UI to match. If options change we just cylce through the options and save to the appropriate recordID.

Now where I hit some bumps is, what if in a later version I decide to add some options. first off, when a program is updated to a later version number, does it still have access to the same recordstore? If not then it's a simple solution and doesn't need any extra work. However if it does then I could have some issues. For example, should options 1 and 2 be related (lets say they both relate to sounds played, and option 3 is completely unrelated. Now if I decide to add another option I either have the RecordIDs of the options out of order (this may not affect the user but it bother's me aesthetically, and seems as though it would make code awkward) or I have to completely reset the options if the RecordStore is the wrong size.

So I suppose an additional question would be, what method would be best? I can see pros and cons on both sides, out of order Option RecordIDs seems like it would tend to be in favor of the user, as options will be consistent between upgrades, and resetting to defaults would seem in favor of myself and maintanence in general.
Old 11-20-2008, 08:21 AM   #2 (permalink)
BlackBerry Extraordinaire
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts

How about this: when the program starts you set all options to the default values (when you add new options you add initialization to default). Then you step through your record store, if it exists, setting option values as specified there. Any option that doesn't have a record retains the default value.

When you build the options screen, you display the current values of the options. When the user exits the options screen you only modify or add as appropriate those values that have changed since the screen was created.
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

NEW MSA 10128641 Galaxy GX2 Calibration Station ALTAIR 4 and 4X Gas detector #2
NEW MSA 10128641 Galaxy GX2 Calibration Station ALTAIR 4 and 4X Gas detector #2 pictureMSA Galaxy GX2 Test Stand+ Cylinder Holder (altair)
MSA Galaxy GX2  Test Stand+ Cylinder Holder (altair) pictureMSA Altair H2S Single Gas Detector, 18 Months Remaining,
MSA Altair H2S Single Gas Detector, 18 Months Remaining,  picturemsa altair 4x
msa altair 4x pictureMSA 5 ALTAIR Part # ABL11A0N0110UL00 NEW IN BOX COMPLETE

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.