The reason is that you are doing string comparisons.  For a string, the
order (least to greatest) is:

"7" "8" "9" "8.5"

Because "8.5" is a longer string.

You should be doing numeric comparisons like:

<cfif cprlookup.cpr_rating gte 7 and cprlookup.cpr_rating lt 9>
 <cfset cpr_ribbon = "red2ndshad.gif">
 <cfelseif cprlookup.cpr_rating gte 9>
 <cfset cpr_ribbon = "blue1stshad.gif">
 </cfif>

HTH,

Howie Hamlin
--
inFusion Project Manager; On-Line Data Solutions, Inc. (631)737-4668
===================================================
Please vote for iMS in the Most Innovative category here:
*** http://www.sys-con.com/ColdFusion/readerschoice2000/ ***
===================================================
Check out inFusion Mail Server - the world's most configurable email server
*** inFusion Authenticator for IIS is now released! (download from
CoolFusion.com) ***
http://www.teletrends.com and http://www.coolfusion.com
Software and utilities for ColdFusion, iHTML, Website, NTMail
Latest versions available from our web site (inFusion Authenticator version
2.0 for WebSite and NTMail is now released)

----- Original Message -----
From: Jacob <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 12, 2000 2:02 PM
Subject: Number comparing


> When I run this:
>
> <cfif trim(cprlookup.cpr_rating) gte "7" and trim(cprlookup.cpr_rating) lt
"9">
> <cfset cpr_ribbon = "red2ndshad.gif">
> <cfelseif trim(cprlookup.cpr_rating) gte "9">
> <cfset cpr_ribbon = "blue1stshad.gif">
> </cfif>
>
> I keep getting blue1stshad.gif for 8.5.
>
> If the number is an 8, it gives it red2ndshad.gif. If the number is an 9,
> it gives it blue1stshad.gif.
>
> The column for the SQL server is as follows:
>
> Column Name Datatype Length Precision Scale
> CPR_Rating decimal 9 18 0
>
> Any suggestions?
>
> Thank You
> Jacob
>
> --------------------------------------------------------------------------
----
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to