Presentation is loading. Please wait.

Presentation is loading. Please wait.

Combo Box Magic! Dynamic Combo Box Design and Implementation Paul Dormody

Similar presentations


Presentation on theme: "Combo Box Magic! Dynamic Combo Box Design and Implementation Paul Dormody"— Presentation transcript:

1 Combo Box Magic! Dynamic Combo Box Design and Implementation Paul Dormody 651-208-9600dorms@inslink.com

2 The Database Backbone The first step is to create 2 tables – –LookupType IDint40 cbNamevarchar501 –Lookups IDint40 abbrevvarchar201 Descriptionvarchar501 lookUpTypeIDint41 sortOrdertinyint11

3 Database Erata Each LookupType name identifies a distinct combo box Make sure that each cbName is unique and descriptive of the combo box that it represents Create a one to many relationship between the ID field in the LookUpType table and the LookuptypeID field in the Lookups table With this backbone, you can easily create and/or edit any number of line items for each combo box used in the application.

4 For Example Create a LookupType record Call the first record states –This record will have an ID = 1 and a cbName value of states In the Lookups table Create 50 records –Each record will have an ID, a state abbreviation, a state name, a lookupTypeID (in this case 1), and a sortorder number. In this example, the lookupTypeID will be 1 for each of the 50 states.

5 Advantages Create and populate unlimited combo boxes with only 2 tables Easy combo box administration –Load the lookups table during login and cache the query within, possibly to refresh every 15 to 30 minutes –Put the query into application or request scope: Select * From lookups –Now use a query of queries to populate each combo box

6 The fun part Information to build all combo boxes now resides in memory –This results in minimal database load –Forms, even very large forms with many combo boxes, load very quickly Build your combo boxes Run the following type of query at the top of the page: Select ID, description FROM request.qlookups WHERE lookupTypeID = 1 order by sortOrder

7 Combo Box Code Each combo box is built using code similar to the following: selected >#description#

8 Application Demonstration! The InsCMS – Insurance Client Management System The Homeowner Info Form: –1. An ASP application designed for multiple brokers/users –2. Many combo boxes on the form –3. Users may often request additional combo box line items Administration –View of the dynamic combo box admin form

9 It’s a Wrap! This technique demonstrates an elegant way to manage combo boxes Main points: –1. Straightforward database implementation –2. Effective use of query caching –3. Use of request or application scope –4. Use of query of queries for combo box population –5. Easily manageable application wide combo box administration


Download ppt "Combo Box Magic! Dynamic Combo Box Design and Implementation Paul Dormody"

Similar presentations


Ads by Google