You could do this: -- main_template.cfm -- <cfset nID = 3 /> <cfinclude template="case_#nID#.cfm" />
-- case_2.cfm -- <br />Two -- case_3.cfm -- <br />three Not quite as easy to edit a several cases at once, but if the cases are reasonably separate, that might provide exactly the behaviour you want. barneyb --- Barney Boisvert, Senior Development Engineer AudienceCentral (formerly PIER System, Inc.) [EMAIL PROTECTED] voice : 360.765.8080 x12 fax : 360.647.5351 www.audiencecentral.com > -----Original Message----- > From: Shawn Grover [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 26, 2003 2:46 PM > To: CF-Talk > Subject: Using variables in a Switch case? > > > CF 5 doesn't like this: > > <cfset nID = 3> > <cfset nTest1 = 2> > <cfset nTest2 = 3> > <cfswitch expression="#nID#"> > <cfcase value="#nTest1#"> > <br>Two > </cfcase> > <cfcase value="#nTest2#"> > <br>three > </cfcase> > </cfswitch> > > It throws an error saying the cfcase must have a constant value. So, if I > do this instead: > > <cfcase value="2"> > <br>Two > </cfcase> > <cfcase value="3"> > <br>three > </cfcase> > > all works as expected. > > The downside is that we have a large number of items where their > IDs will be > changing on a regular basis (update, and replace in a different system > assigns a new ID - our code is keyed on that ID). We are assigning these > IDs into a structure in application.cfm to minimize the number of > changes we > need to make when the IDs change. But, this switch block doesn't > like that > plan. Is there any way to do this with the variables? > > Thanks in advance. > > Shawn > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

