Unfortunately the 5 territory thing was just a simplified example meant to demo the idea. The real thing is quite a bit more complex. And the 50 thing was 50 U.S. states. That one can be safely hardcoded in :D.
At one point in an effort to ease maintenance concerns we tried the db route, but on a different aspect of the in-house system. We found that running against the db rather than just in code put on a much higher load. Since this was client/server, if we did the procedure in code it ran on the individual client's memory and processor. If we plugged in a centralized db then we of course introduced a bottleneck into the system. ------------------------------------------- Matt Robertson, [EMAIL PROTECTED] MSB Designs, Inc. http://mysecretbase.com ------------------------------------------- ---------- Original Message ---------------------------------- From: jon hall <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] date: Wed, 26 Mar 2003 18:54:05 -0500 >If you have a situation with 50 possible branchs, with 50 different >pieces of logic (imagine that flowchart! lol), hard-coding the >branches conditions would seem at least from my point of view, the >wrong way to go about it. If you already have 50, the chances are that >the conditions will change as business rules change later on (as in >the case of zip codes). > >Just looking at your code, I'd think sticking all the zip's in a >database with their corresponding numbers (1,2,3...looks like only 5 >possible branches in the code below?) and simply select out the >necessary data would be more elegant, and need less tinkering as >business rules change. > >Not that it wouldn't be nice to have the option to have dynamic >case statements, but you asked :) > >-- > jon > mailto:[EMAIL PROTECTED] > >Wednesday, March 26, 2003, 6:25:34 PM, you wrote: >MR> James wrote: >>>Uhm.. If..elseif..elseif..elseif..etc..else..endif >MR> and >>>CFMX has the same "problem". > >MR> And rest assured it is a problem that is not afflicted on every language. I >posted a feature request for this functionality and some others to Macromedia and it >didn't get anywhere. My >MR> impression was the speed of the tag would have been degraded in this environment >if such a feature had been added. Shame because it is incredibly powerful. > >MR> Lets say, for example, you have a chunk of code that has to branch in one of 50 >directions, and those directions are variable depending on stuff that happened >further up the pipe. > >MR> Compare the exercution time of hobbling thru 50 elseifs versus one case statement >where the only code that gets executed is the case you need at the moment. > >MR> Or wouldn't it be nice to be able to code this: > >MR> select case zipcode% >MR> case 93701:territory%=1 >MR> case is 93702 to 93750:territory%=2 >MR> case is 93751, 93752, 93754, 93755 to 94900:territory%=3 >MR> case > 94901:territory%=4 >MR> case else:territory%=5 >MR> end case > >MR> Can you write this some other way? Yes. As elegantly? I had to translate an >insurance company's entire rating system into CF and I sorely missed the ability to >use variables and ranges in case >MR> statements. So would you if you had the opportunity to use them. > >MR> I'd like to see something like this in CF still. Never mind the speed. Look at >the functionality. > >MR> ------------------------------------------- >MR> Matt Robertson, [EMAIL PROTECTED] >MR> MSB Designs, Inc. http://mysecretbase.com >MR> ------------------------------------------- > > > >MR> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4