Just because I can't help myself, you may find the whole thing more readable,
and easier to maintain with a CFSWITCH statement in place of all those ELSE's.
Also probably more performant with only parsing the string once or twice per
loop.
<cfoutput query="Recordset1">
<cfset route = "Invalid">
<cfswitch expression="#mid(current_route_id, 1, 2)#">
<cfcase value="01">
<cfset route = "Phoenix">
</cfcase>
<cfcase value="02">
<cfset route = "P">
</cfcase>
<cfcase value="03">
<cfset route = "M">
</cfcase>
<cfcase value="04">
<cfset route = "S">
</cfcase>
<cfcase value="05">
<cfset route = "T">
</cfcase>
<cfcase value="07">
<cfset route = "X">
</cfcase>
<cfcase value="08">
<cfset route = "PU">
</cfcase>
<cfcase value="09">
<cfset route = "UPS">
</cfcase>
<cfcase value="10">
<cfset route = "G">
</cfcase>
<cfcase value="11">
<cfset route = "Inactive">
</cfcase>
<cfcase value="A0">
<cfif listFindNoCase("A01,A02,A03,A04", mid(current_route_id,
1, 3))>
<cfset route = mid(current_route_id, 1, 3) />
</cfif>
</cfcase>
</cfswitch>
<!-- Outputs the variables in Recordset in a table -->
</cfoutput>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324886
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4