ASP classic - variable formatting

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default ASP classic - variable formatting

    Hi all!

    I've included a code sample below.

    I am trying to format a table cell so that if the value is outside some
    predefined range, the bgcolor parameter is different. I realize this has
    probably be done a million times, but I can't find any solution. I run the
    ASP below, and every value returned from the database is treated as a string
    (all left justified). Is there a character-to-numeric conversion function
    I've forgotten about so the sample below performs properly? Near the
    bottom, the Furnace Temperature value, for example. All values are
    currently over 1200. Or should I say "1200"........?

    cheers,
    Matt.

    <tr<% IF (intRowCounter MOD 2) = 0 THEN %> bgcolor="vbCyan" <% END IF %>>

    <td><font size = -4><%= rsIndustrial("MACHINE_NUMBER") %></font></td>

    <td><font size = -4><%= rsIndustrial("SERIAL_NUMBER") %></font></td>

    <td><font size = -4><%= rsIndustrial("DAILY_PART_COUNT") %></font></td>

    <td><font size = -4><%= rsIndustrial("EVENT_TIME") %></font></td>

    <td><font size = -4><%= rsIndustrial("ACTUAL_SLOW_SHOT_VELOCITY")
    %></font></td>

    <td><font size = -4><%= rsIndustrial("ACTUAL_INTERMEDIATE_SHOT_VELOCITY")
    %></font></td>

    <td><font size = -4><%= rsIndustrial("ACTUAL_FAST_SHOT_VELOCITY")
    %></font></td>

    <td><font size = -4><%= rsIndustrial("FINAL_INTENSIFIER_PRESSURE")
    %></font></td>

    <td><font size = -4><%= rsIndustrial("INTENSIFIER_PRESSURE_TO_RISE_TO")
    %></font></td>

    <td><font size = -4><%= rsIndustrial("TIE_BAR_#1_MECHANICAL_TONNAGE")
    %></font></td>

    <td><font size = -4><%= rsIndustrial("TIE_BAR_#2_MECHANICAL_TONNAGE")
    %></font></td>

    <td><font size = -4><%= rsIndustrial("TIE_BAR_#3_MECHANICAL_TONNAGE")
    %></font></td>

    <td><font size = -4><%= rsIndustrial("TIE_BAR_#4_MECHANICAL_TONNAGE")
    %></font></td>

    <td><font size = -4><% IF rsIndustrial("FURNACE_TEMPERATURE") > 900 THEN
    %><bgcolor="vbRed"><% END IF%><%= rsIndustrial("FURNACE_TEMPERATURE")
    %></font></td>

    <td><font size = -4><% IF rsIndustrial("BISCUIT_LENGTH_LOW") = strTrue THEN
    %> <font color="vbRed" <% END IF%><%= rsIndustrial("BISCUIT_LENGTH_LOW")
    %></font></td>

    <td><font size = -4><%= rsIndustrial("BISCUIT_LENGTH_GOOD") %></font></td>

    <td><font size = -4><%= rsIndustrial("BISCUIT_LENGTH_HIGH") %></font></td>

    </tr>


    Matt. Guest

  2. Similar Questions and Discussions

    1. .NET COM in Classic ASP
      I have created a simple .NET COM class. I have used regasm dllname.dll /tlb: dllname.tlb /codebase to register it on another server - the files...
    2. DLL Issue With Classic Asp
      Hi everyone, Not sure if this is the right newsgroup for this, but I think it is. I've been having trouble finding any good info on the...
    3. Distiller 5.0.5 is Classic App?
      I bought Acrobat 5.0 almost 4 years ago and it works fine with OS X - Except that I now for the first time need to use distiller for a client's job...
    4. MAC OS X NOT BETTER THAN CLASSIC!!
      OK, I have been using Mac OS X since version 10.0. Now, as a Mac user for more than 13 years, a UNIX/Linux user for more than 8 years, and as IT...
    5. Classic ASP Table to DataGrid...formatting color and decimal places
      Hello, I trying to convert an ASP page to ASP.NET using a DataGrid control. All of the data is being displayed in the DataGrid. But I need help...
  3. #2

    Default Re: ASP classic - variable formatting

    CInt(myString) to integer
    CDbl(myString) to double
    CLng(myString) to long


    Maarten Guest

  4. #3

    Default Re: ASP classic - variable formatting

    Thanks.

    I had completely forgotten about those. I also need to edit my <td> tags a
    little.

    Any idea why vbRed is giving me a Blue cell?

    cheers,
    Matt.

    <td <% IF CINT(rsIndustrial("FURNACE_TEMPERATURE")) < 1230 OR
    CINT(rsIndustrial("FURNACE_TEMPERATURE")) > 1290 THEN %>bgcolor="vbRed" <%
    END IF%>><font size = -4><%= rsIndustrial("FURNACE_TEMPERATURE")
    %></font></td>



    "Maarten" <nobody@spam.com> wrote in message
    news:fYumc.97620$qC1.6081664@phobos.telenet-ops.be...
    > CInt(myString) to integer
    > CDbl(myString) to double
    > CLng(myString) to long
    >
    >

    Matt. Guest

  5. #4

    Default Re: ASP classic - variable formatting


    Because it is not know by HTML

    bgcolor="<%vbred%>" maybe helps or use

    bgcolor="#FF0000"


    Maarten Guest

  6. #5

    Default Re: ASP classic - variable formatting

    Because whatever editor you are using doesn't understand that your opening
    ASP tags end within the HTML ... in other words, it can't differentiate well
    between server-side and client-side script.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    "Matt." <matt_benvenuti_remove@hotmail.com> wrote in message
    news:87vmc.36304$3Q4.957666@news20.bellglobal.com. ..
    > Thanks.
    >
    > I had completely forgotten about those. I also need to edit my <td> tags
    a
    > little.
    >
    > Any idea why vbRed is giving me a Blue cell?
    >
    > cheers,
    > Matt.
    >
    > <td <% IF CINT(rsIndustrial("FURNACE_TEMPERATURE")) < 1230 OR
    > CINT(rsIndustrial("FURNACE_TEMPERATURE")) > 1290 THEN %>bgcolor="vbRed" <%
    > END IF%>><font size = -4><%= rsIndustrial("FURNACE_TEMPERATURE")
    > %></font></td>
    >
    >
    >
    > "Maarten" <nobody@spam.com> wrote in message
    > news:fYumc.97620$qC1.6081664@phobos.telenet-ops.be...
    > > CInt(myString) to integer
    > > CDbl(myString) to double
    > > CLng(myString) to long
    > >
    > >
    >
    >

    Aaron Bertrand - MVP Guest

  7. #6

    Default Re: ASP classic - variable formatting

    Oh good catch, I missed that part... I thought he meant his editor showed it
    as blue (which FrontPage et al. might do if it's confused).

    Anyway, your correction made a common mistake.

    bgcolor="<%vbred%>"

    Should be

    bgcolor="<%=vbred%>"

    The = sign in there is pretty important.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    "Maarten" <nobody@spam.com> wrote in message
    news:fwvmc.97647$1J1.6114439@phobos.telenet-ops.be...
    >
    > Because it is not know by HTML
    >
    > bgcolor="<%vbred%>" maybe helps or use
    >
    > bgcolor="#FF0000"
    >
    >

    Aaron Bertrand - MVP Guest

  8. #7

    Default Re: ASP classic - variable formatting

    Once again, thank you very much. The <%vbred%> didn't work. But the FF0000
    did.

    cheers,
    Matt.

    "Maarten" <nobody@spam.com> wrote in message
    news:fwvmc.97647$1J1.6114439@phobos.telenet-ops.be...
    >
    > Because it is not know by HTML
    >
    > bgcolor="<%vbred%>" maybe helps or use
    >
    > bgcolor="#FF0000"
    >
    >

    Matt. Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139