tracker issue : CF-3686134

select a category, or use search below
(searches all categories and all time range)

Temporary CFCASE scope during CFSWITCH

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/NotWorthEffort

Reporter/Name(from Bugbase): Aaron Martone / Aaron Martone (Aegis Kleais)

Created: 12/18/2013

Components: Core Runtime

Versions: 10.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: - /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Windows 7 SP1 64-bit

Vote Count: 0

This may or may not be a good idea, all depending on how you code, but like how there is a CFCATCH scope available to caught exceptions, many times I find myself performing an in-depth equation for the expression of <cfswitch>.  It would be nice if a temporary scope could exist for the duration of the <cfswitch> that allows me to quickly reference the matched value.  ie:

<cfswitch expression="#listFindNoCase( listLast( cgi.http_host, '.' ), 'dev' )#">

<cfcase value="dev,stag">You are a non-public environment, the: #cfcase.value# environment.</cfcase> <!--- cfcase.value would be either 'dev' or 'stag'. --->
<cfdefaultcase>You are on a public environment, the: #cfcase.value# environment.</cfdefaultcase>


It would also exist for cfscript use as well.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3686134

External Customer Info:
External Company:  
External Customer Name: Aegis Kleais
External Customer Email:  
External Test Config:



Whilst it makes the CF dev's life a bit easier in a given edge case, it's a lot of horsing around for Adobe when all *you* need to do is: <cfset caseValue = listFindNoCase( listLast( cgi.http_host, '.' ), 'dev' )> <cfswitch expression="#caseValue#"> <cfcase value="dev,stag"> <!--- and you will know that caseValue will have the value you want ---> </cfcase> -- Adam
Comment by External U.
13822 | December 19, 2013 08:53:32 AM GMT
+1 to Adam. It is not worth the effort adding this in the language when you have so many easier ways to achieve this. WIll not be fixed.
Comment by Rupesh K.
13823 | December 19, 2013 10:24:00 AM GMT