Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2004
    Posts
    4

    Unanswered: Highlighting tables from DB?

    Hi everyone,

    Ive created a web page that queries a db and i have that all working fine. What i dont have though and would like to be able to do is get the page to highlight rows according to one colums value, ie


    Colum1 Colum2
    Row 1 50 Test <-- would like to the be highlihted lite blue for instance
    Row 2 90 Test2 <-- would like this to be highlighted red for instance

    Ive attached a file to show what i mean, any help on this would be much appreciated
    Attached Thumbnails Attached Thumbnails help.JPG  

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    that's easy enough, create a style sheet with a class for a standard row and one for a selected row then when you are outputting the data check the values and and if it should be selected set the class of the row to the appropriate style else leave it with the default style...

  3. #3
    Join Date
    Sep 2004
    Posts
    4
    um sorry but i aint that advanced. woudl you care to spell it out a little more?

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    okie, you a simpler version....assuming you are building the table by looping through a recordset or something....
    Code:
    <table>
      
      <%
      Do while not myRecordset.EOF
        bgcolor = "#FFFFFF"
        if myRecordset("value1")=0 then bgcolor="#CCCCCC"
      %>
        <tr bgcolor="<%=bgcolor%>"><td><%=myRecordset("value1")%></td></tr>
      <%
        myRecordset.MoveNext
      Loop
      %>
    </table>
    clear as mud??

  5. #5
    Join Date
    Sep 2004
    Posts
    4
    not really, i connect to the DB usign

    Code:
    <%
    fp_sQry="SELECT * FROM AlarmView WHERE (NameAlarm like  'NeaxAlarm%' AND NameEquip LIKE 'TAX%')"
    fp_sDefault=""
    fp_sNoRecords="<tr><td colspan=4 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
    fp_sDataConn="SuperviewTest"
    fp_iMaxRecords=300
    fp_iCommandType=1
    fp_iPageSize=15
    fp_fTableFormat=True
    fp_fMenuFormat=False
    fp_sMenuChoice="Sent"
    fp_sMenuValue="Sent"
    fp_sColTypes="&KeyAlarm=3&Received=135&Touched=135&Sent=135&NameAlarm=202&Display=202&Oid=202&KeyEquip=3&KeyDeviceDriverClass=3&NameEquip=202&IpAddress=202&KnownAs=202&TimeZone=202&NameEquipClass=202&Components1=202&Components2=202&Components3=202&Components4=202&Components5=202&"
    fp_iDisplayCols=4
    fp_fCustomQuery=False
    BOTID=0
    fp_iRegion=BOTID
    %>
    i have played around and been able to get it to color the whole severity colum one color, but still cannot get it to change based on the rows value. Also was hopefully wanting the color to go across the whole row if possible which currently i am unable to do.


    *** Edited to add screenie and also add the code into code box.
    Attached Thumbnails Attached Thumbnails help2.JPG  
    Last edited by ashrak; 09-22-04 at 21:30.

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    well you could post the whole page of code and we could look at that... what are you using to write your page??

  7. #7
    Join Date
    Sep 2004
    Posts
    4
    all good ive completed the page the code i used was

    Code:
    x = CINT(FP_FieldVal(fp_rs,"Severity"))
    if x <= 10 then
    bgcolor = "#E42217"
    elseif x => 11 and x <= 30 then
    bgcolor = "orange"
    elseif x => 31 and x <= 50 then
    bgcolor = "yellow"
    elseif x => 51 and x <= 70 then
    bgcolor = "#82CAFF"
    elseif x => 71 and x <= 90 then
    bgcolor = "#41A317"
    end if
    %>
    and then added this to the where the tables were drawn after the query of the database

    Code:
     <td BGCOLOR=<%=bgcolor%>>


    Thanks for your initial help anyways much appreciated
    Last edited by ashrak; 09-23-04 at 22:14. Reason: Adding code into code box

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •