You can also make the if/else statements more readable by getting rid of the unnecessary quotes and hashes:
<cfesleif mid(current_route_id,1,2) IS "02"> mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ 2009/7/24 Michael Stevens <bigm...@bigmikes.org>: > > If it were PHP that's what I would've done but we have only a handful of > cold fusion pages and I didn't want to spend a load of time on it. I think > I'll take your suggestion and implement it that way in the future I'll have > a sample to go by should I need to do it again... > > Thanks. > > -----Original Message----- > From: Jason Fisher [mailto:ja...@wanax.com] > Sent: Thursday, July 23, 2009 11:30 AM > To: cf-talk > Subject: Re: cfif, cfifelse problem... Invalid token '''... > > > 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:324912 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4