Advertisement

08.30.2005 at 06:10AM PDT, ID: 21544748
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.4

Display value 0 or N/A when data or table are not available

Asked by vico1 in Active Server Pages (ASP)

Tags: ,

I have the followin Script:
-----------------------------------------------------------------------Problem---------------------------------------------------------------------------------
<%
set objConnection=Server.CreateObject("ADODB.Connection")
objConnection.ConnectionTimeout = 15
objConnection.CommandTimeout =  10
objConnection.Mode = 3 'adModeReadWrite
if objConnection.state = 0 then
  objConnection.Open "Site0001"
end if

strSQL = "SELECT Count(*) AS tCar, Count(T_AMT_TAX) AS billedTrans, Count(T_VOIDCODE) AS totalVoid, Count(T_FLEET) AS totalFleet, AVG(T_AMT_TAX) AS numT_AMT_TAX, SUM(T_AMT_TAX) AS numsT_AMT_TAX, SUM(T_DISCOUNT) AS numT_DISCOUNT, SUM(T_TAX) AS numT_TAX, AVG(T_DISCOUNT) AS numsT_DISCOUNT FROM Tranhead"
set objRS=Server.CreateObject("ADODB.RecordSet")

objRS.Open strSQL,objConnection,3,3



tCars=objRS("tCar")
bCars=objRS("billedTrans")
tFleet=objRS("totalFleet")
tVoid=objRs("totalVoid")
tCSI=FormatCurrency(objRS("numT_AMT_TAX"))
tDisc=FormatCurrency(objRS("numT_DISCOUNT"))
tTax=FormatCurrency(objRS("numT_TAX"))
gTotal=FormatCurrency(objRS("numsT_AMT_TAX"))
avgDisc=FormatCurrency(objRs("numsT_DISCOUNT"))

objRS.Close
Set objRS = Nothing
objConnection.close
set objConnection = Nothing
%>
 


The variables are displayed in a prebuild table like follow:

<table border="1" width="100%" cellspacing="0" cellpadding="0" id="table1" style="text-indent: 0; line-height: 100%; word-spacing: 0; margin: 0">
      <tr>
            <td width="38" align="center" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Logged</font></b></p>
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Veh</font></b></td>
            <td align="center" width="48" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Billed&nbsp; </font></b>
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Veh</font></b></td>
            <td align="center" width="38" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Total </font></b></p>
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Fleets</font></b></td>
            <td align="center" width="64" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Average</font></b></p>
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Ticket</font></b></td>
            <td align="center" width="76" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Total</font></b></p>
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Discount</font></b></td>
            <td align="center" width="70" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Total Tax</font></b></td>
            <td align="center" width="61" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Average</font></b></p>
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Discount</font></b></td>
            <td align="center" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Grand</font></b></p>
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Total</font></b></td>
            <td align="center" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font color="#FFFF00" face="Verdana" size="1">Voided</font></b></td>
            <td align="center" bgcolor="#000000">
            <p style="margin-top: 0; margin-bottom: 0"><b>
            <font face="Verdana" size="1" color="#FFFF00">Removed</font></b></td>
      </tr>
      <tr>
            <td width="47" align="center" bgcolor="#FFFFFF">
            <font face="Verdana" style="font-size: 70%; font-weight: 700">&nbsp;<%=tCars%></font></td>
            <td align="center" width="48" bgcolor="#FFFFFF">
            <font face="Verdana" style="font-size: 70%; font-weight: 700" color="#800080">&nbsp;<%=bCars%></font></td>
            <td align="center" width="38" bgcolor="#FFFFFF">
            <font face="Verdana" style="font-size: 70%; font-weight: 700">&nbsp;<font color="#FF00FF"><%=tFleet%></font></font></td>
            <td align="center" width="64" bgcolor="#FFFFFF">
            <font face="Verdana" style="font-size: 70%; font-weight: 700">&nbsp;<%=tCSI%></font></td>
            <td align="center" width="76" bgcolor="#FFFFFF">
            <font face="Verdana" style="font-size: 70%; font-weight: 700" color="#FF0000">&nbsp;<%=tDisc%></font></td>
            <td align="center" width="70" bgcolor="#FFFFFF">
            <font face="Verdana" style="font-size: 70%; font-weight: 700">&nbsp;<%=tTax%></font></td>
            <td align="center" width="61" bgcolor="#FFFFFF">
            <font face="Verdana" style="font-size: 70%; font-weight: 700" color="#FF0000">&nbsp;<%=avgDisc%></font></td>
            <td align="center" bgcolor="#FFFFFF" width="58">
            <font face="Verdana" style="font-size: 70%; font-weight: 700" color="#008000">&nbsp;<%=gTotal%></font></td>
            <td align="center" bgcolor="#FFFFFF" width="40">
            <font face="Verdana" style="font-size: 70%; font-weight: 700">&nbsp;<%=tVoid%></font></td>
            <td align="center" bgcolor="#FFFFFF" width="49">
            &nbsp;</td>
      </tr>
</table>
-------------------------------------------------------------------Question-----------------------------------------------------------------------------

I need to display Value 0 or N/A if

1.-the connection to the table is not available
2.-or if the table is empty.

in a way I need to get red of the "page cannot be displayed" message when Data is not available

Thanks in advanceStart Free Trial
 
 
Loading Advertisement...
 
[+][-]08.30.2005 at 06:24AM PDT, ID: 14784153

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Active Server Pages (ASP)
Tags: display, t_discount
Sign Up Now!
Solution Provided By: OMC2000
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.30.2005 at 06:32AM PDT, ID: 14784215

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 14-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.30.2005 at 06:33AM PDT, ID: 14784232

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.30.2005 at 07:05AM PDT, ID: 14784556

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43