<cfif recordset.field eq 23> - doesn't work <cfif "#recordset.field#" eq "23"> - does
The field is an integer, so the top comparison should match. This is just an example, there are more complicated ones too... <cfset variables.thisvar = variables.thatvar> is the same as <cfset variables.thisvar = "#variables.thatvar#"> I know this, in theory, I am just wondering about the deeper practical implementation of it. I know in ASP Cint()-ing both sides of an if statement does sometimes fix problems, because a string with value "2" is not the same as an integer with value 2, which is not the same as a recordset.field.value that is a variant with a value of 2... -----Original Message----- From: Stephen Moretti [mailto:[EMAIL PROTECTED] Sent: 04 May 2005 10:28 To: CF-Newbie Subject: Re: ColdFusion and Database[Scanned] Richard Hensman wrote: >I have a question on this note. I have found that sometimes when I do >that, my variables don't "eq" when they should, and sometimes even >cfset goes wrong (normally when I'm concatting or otherwise changing >variables though, not a straight assign). Does CF have some kind of >late type-casting that it's performing incorrectly or perhaps just >differently on different variables that might be causing this? If I >compare "#Var_Name#" - I never get that problem, and I've assumed it's >because it will type-cast to a string/character type this way? > >Any ideas anyone? > > hmmmm.... well <cfset variables.thisvar = variables.thatvar> is the same as <cfset variables.thisvar = "#variables.thatvar#"> so I can only assume that something else is going on, probably in your concatenation, that you are resolving by evaluating the content of the variable in the cfset. Do you have a code and data example where your variables end up not being equal and the same code redone using #'s? Stephen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Purchase Dreamweaver with Homesite Plus from House of Fusion, a Macromedia Authorized Affiliate and support the CF community. http://www.houseoffusion.com/banners/view.cfm?bannerid=54 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:875 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
