1、Dynamic form generation using a normalized database,by Ann Bernstein Twin Cities CFUG September 1, 2004,MSW Fees Survey: an “e-government” project,Annual survey to find out about fees being assessed by local governments (counties, cities, towns) for solid waste management services. Our first year as
2、 the data collection agency; we want to make a good impression! Last year we collected other data online and it was very successful,Project Requirements,secure logins for 3,000 potential users (cities, counties, and townships) users can save data between logins easy to usesome users are inexperience
3、d admin features,Heres what the survey form looks like:,Tour the web app online.,Two key design considerations:,nearly all data is quantitative content of survey was not finalized when we began development.,Flat file or normalized database?,We used a flat-file last time. Code was lengthy and repetit
4、ive, and therefore prone to bugs. This time we decided to try something new and use a normalized database.,Heres a flat-file database,Flat file issues:,Difficult to query data in separate columns. Structure must be modified every time survey questions are added/deleted/modified. Lots of empty cells
5、in database.,Heres a normalized database,Normalized db advantages:,Easy to query Flexible questions could be modified without changing structure. Dense data storage Allows for dynamic CF form!,Our final database structure:,Main CF pages used in survey:,Initialization page creates 2d array in session
6、 variable to store questions and answers. Survey page loops through array to display form questions (and answers, if any exist). Validation page plugs form data into array, checks data, and submits it to database if valid. If not, form redisplays with error highlighted.,Advantages of dynamic form wi
7、th normalized db,Code is short and sweet. Debugging is much faster because youre only creating a single form element! Questions can be added or changed until the last minute. Data analysis is fast and easy Application is reusable.,Room for improvement (any suggestions?),2d array is awkward to use. H
8、ard to read code (what does aryQA17 refer to?) Index must correspond to key field, so keys must be kept in perfect sequence. Admin features were afterthought & klugey Good database design does not necessarily result in easy coding in CF.,Questions/comments?,Ann Bernstein (651) 215-0258 ann.bernstein moea.state.mn.us,
copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1