Choice lists are a very popular and useful feature. They are easy to implement—just create a list, assign it to a field or variable and 4D will present the choice list during data entry. It’s not uncommon to see a structure containing 20 to 30 choice lists, or even more.
If you are designing a database for a user application, there is a good reason to leave many of the choice lists defined as “User Modifiable.” That way the end users will be able to tailor choice lists to suit their ever-changing needs. However, all choice lists are saved in the structure, and this situation can present a significant problem down the road. At some point you will probably deploy a new and improved structure. Expect some very disappointed end users when they discover that their self-customized choice lists have been replaced by the original default choice lists!
Every 4D developer encounters this dilemma at some time or another. The solution is of course to save the choice lists with the data and just rebuild the modifiable choice lists immediately upon the first launch of the newly received structure.
The purpose of this technical note is to present a scheme for saving and maintaining user modifiable choice lists using generic and modular code. You can literally copy and paste the methods into your own structure and have a workable choice list saving system in place within minutes. Some of you may require a more complex solution. In that case, you can use this technical note as a basis for designing your own specific solution. Please refer to the accompanying example database “SaveListsDemo.”
Tech Note