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
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to