Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 22nd, 2005, 03:19 AM
cubanallstar cubanallstar is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 8 cubanallstar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 37 sec
Reputation Power: 0
Problems with simple 'IF' statement

Can someone please shed some light on why the below code won't work?? It's driving me a bit mental!

What i'm trying to do is to color code various cells of a table depending on its value. I have a customer id and a product id and am calculating percentages of job completion based upon products given individual product id's. Problems i think appear to be arising not only due to errors in the code but also as a result of having no product id's for customers. How can i fix this?

<% If objProduct("AVGENQUIRYRECEIVED").Value >= 0.6 AND OBJPRODUCT("AVGENQUIRYRECEIVED") <= 1 THEN %><%="<TD BGCOLOR=#66DAA>"%><%ELSE IF OBJPRODUCT("AVGENQUIRYRECEIVED") < 0.6 AND OBJPRODUCT("AVGENQUIRYRECEIVED") >= 0.3 THEN%><%="<TD BGCOLOR=#FF6347>"%><%ELSE%><% IF OBJPRODUCT("AVGENQUIRYRECEIVED") < 0.3 AND OBJPRODUCT("AVGENQUIRYRECEIVED") >= 0 THEN%><%="<TD BGCOLOR=#FFA500>"%><%END IF%><%END IF%><%END IF%><%= FORMATPERCENT((OBJPRODUCT("AVGENQUIRYRECEIVED").VALUE), 0, -2, -2, -2) %>

Thanks in advance,

J.
Manchester, UK.

Reply With Quote
  #2  
Old September 22nd, 2005, 08:23 AM
cubanallstar cubanallstar is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 8 cubanallstar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 37 sec
Reputation Power: 0
Don't worry kids, looks like it was just a simple problem with syntax. Below is the correct code for reference:

<% If objProduct("AVGENQUIRYRECEIVED") >= 0.66 THEN RESPONSE.WRITE "<TD BGCOLOR=GREEN>" ELSE IF objProduct("AVGENQUIRYRECEIVED") >= 0.33 THEN RESPONSE.WRITE "<TD BGCOLOR=ORANGE>" ELSE RESPONSE.WRITE"<TD BGCOLOR=RED>" END IF %><%= FORMATPERCENT((OBJPRODUCT("AVGENQUIRYRECEIVED").VALUE), 0, -2, -2, -2) %> </TD>

TA.

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Problems with simple 'IF' statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway