Adding numbers in DB columns (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


spcafc -> Adding numbers in DB columns (1/31/2007 8:38:00)

Any idea on how to do this? Here's what I want to do:

Take all the numbers in Column A and add them up, then display that total in a table on a a web page.

But this would need to be for multiple columns ie Columns A, B, C, D need to be added up individually and displayed individually.

Make sense?

Rebecca




rdouglass -> RE: Adding numbers in DB columns (1/31/2007 8:55:40)

quote:

But this would need to be for multiple columns ie Columns A, B, C, D need to be added up individually and displayed individually.


I'm not sure exactly what that means but you can set a variable and add values to it as you loop thru displaying. For instance:

<%DIM totalA, totalB
totalA = 0
TotalB = 0%>

Then while you're displaying the values, add them to the appropriate totals:

<%totalA = totalA + valueA%>

Then at the end of your column, display the value:

<%=totalA%>

Does that make sense? If not, maybe you can post what you have?




spcafc -> RE: Adding numbers in DB columns (1/31/2007 11:12:23)

Basically what I need is all of Column A added up and the results placed into one cell in the table. Again for Columns B, C, D etc.




swoosh -> RE: Adding numbers in DB columns (1/31/2007 11:25:47)

One work around would be to do a query on the table Totaling the fields.....however I believe this will force you to have two results on the page.....one for the table and then one for the query




rdouglass -> RE: Adding numbers in DB columns (1/31/2007 11:38:55)

quote:

Basically what I need is all of Column A added up and the results placed into one cell in the table.


What I posted should do that. Have you tried it? If so and ift failed, can you post any error messages or maybe your code?

(Please don't post your code untill you have attempted this.)




spcafc -> RE: Adding numbers in DB columns (1/31/2007 14:07:09)

I've not tried the code yet.

Where exactly would I be placing it?

Ok - if you look here: http://www.spcafc.org/adoption_dog.asp
you'll see the results I get from just doing a straight DBRW. Now instead of having all those results I want one table with all the numbers for Adoption_Dog to be totaled and the result placed in the box where the number is.




rdouglass -> RE: Adding numbers in DB columns (1/31/2007 14:18:18)

quote:

Where exactly would I be placing it? I need to use the DBRW right?


You would place the first chunk (where the variables are DIM'ed) above any database stuff.

You don't *have* to use the DRW (you can use straight ASP if you like); but you were talking about adding up the column results, right? Everytime you display (or read) a column value, you'd add it to the total.

Does that make sense?

If not, please post your DRW (or ASP) code where you are pulling the values you want to total. Then I will show you an example using your code.




spcafc -> RE: Adding numbers in DB columns (1/31/2007 14:47:12)

Here's the code:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Adoption_Dog</title>
</head>
<body>

<!--webbot bot="DatabaseRegionStart" s-columnnames="ID,Addition/Correction,Proof,Focus,Focus1,Name,County,MailingAddress,MailingAddress2,City,State,ZipCode,PhysicalAddress,PhysicalCity,PhysicalAddress2,PhysicalState,PhysicalZipCode,Phone,Fax,Email,Website,vetCare501,SN501,LowCost501,LowCost5012,respondToComplaints501,shelter501,euthanize501,rescueFosterSanctuary501,educate501,careAndTraining501,shelterSupport501,feralStrayTraps501,other501,Intake_Dog,Intake_Cat,Adoption_Dog,Adoption_Cat,Euthanasia_Dog,Euthanasia_Cat,SNFund,SNFund2" s-columntypes="3,202,202,202,202,202,202,202,202,202,202,3,202,202,202,202,3,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,3,3,3,3,3,3,202,202" s-dataconnection="db1" b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="5" b-makeform="FALSE" s-recordsource="Organizations" s-displaycolumns="Adoption_Dog,Adoption_Cat,Euthanasia_Dog,Euthanasia_Cat" s-criteria s-order s-sql="SELECT * FROM Organizations" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc" u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the start of a Database Results region. The page must be fetched from a web server with a web browser to display correctly; the current web is stored on your local disk or network.</font></td></tr></table>" startspan --><!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Organizations"
fp_sDefault=""
fp_sNoRecords=""
fp_sDataConn="db1"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&Addition/Correction=202&Proof=202&Focus=202&Focus1=202&Name=202&County=202&MailingAddress=202&MailingAddress2=202&City=202&State=202&ZipCode=3&PhysicalAddress=202&PhysicalCity=202&PhysicalAddress2=202&PhysicalState=202&PhysicalZipCode=3&Phone=202&Fax=202&Email=202&Website=202&vetCare501=202&SN501=202&LowCost501=202&LowCost5012=202&respondToComplaints501=202&shelter501=202&euthanize501=202&rescueFosterSanctuary501=202&educate501=202&careAndTraining501=202&shelterSupport501=202&feralStrayTraps501=202&other501=202&Intake_Dog=3&Intake_Cat=3&Adoption_Dog=3&Adoption_Cat=3&Euthanasia_Dog=3&Euthanasia_Cat=3&SNFund=202&SNFund2=202&"
fp_iDisplayCols=4
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="2325" --><table BORDER="1">
	<tr>
		<td><b>Adoption_Dog:</b></td>
		<td>
		<!--webbot bot="DatabaseResultColumn" s-columnnames="ID,Addition/Correction,Proof,Focus,Focus1,Name,County,MailingAddress,MailingAddress2,City,State,ZipCode,PhysicalAddress,PhysicalCity,PhysicalAddress2,PhysicalState,PhysicalZipCode,Phone,Fax,Email,Website,vetCare501,SN501,LowCost501,LowCost5012,respondToComplaints501,shelter501,euthanize501,rescueFosterSanctuary501,educate501,careAndTraining501,shelterSupport501,feralStrayTraps501,other501,Intake_Dog,Intake_Cat,Adoption_Dog,Adoption_Cat,Euthanasia_Dog,Euthanasia_Cat,SNFund,SNFund2" s-column="Adoption_Dog" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Adoption_Dog<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Adoption_Dog")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="25177" --></td>
	</tr>
	<tr>
		<td><b>Adoption_Cat:</b></td>
		<td>
		<!--webbot bot="DatabaseResultColumn" s-columnnames="ID,Addition/Correction,Proof,Focus,Focus1,Name,County,MailingAddress,MailingAddress2,City,State,ZipCode,PhysicalAddress,PhysicalCity,PhysicalAddress2,PhysicalState,PhysicalZipCode,Phone,Fax,Email,Website,vetCare501,SN501,LowCost501,LowCost5012,respondToComplaints501,shelter501,euthanize501,rescueFosterSanctuary501,educate501,careAndTraining501,shelterSupport501,feralStrayTraps501,other501,Intake_Dog,Intake_Cat,Adoption_Dog,Adoption_Cat,Euthanasia_Dog,Euthanasia_Cat,SNFund,SNFund2" s-column="Adoption_Cat" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Adoption_Cat<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Adoption_Cat")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="25061" --></td>
	</tr>
	<tr>
		<td><b>Euthanasia_Dog:</b></td>
		<td>
		<!--webbot bot="DatabaseResultColumn" s-columnnames="ID,Addition/Correction,Proof,Focus,Focus1,Name,County,MailingAddress,MailingAddress2,City,State,ZipCode,PhysicalAddress,PhysicalCity,PhysicalAddress2,PhysicalState,PhysicalZipCode,Phone,Fax,Email,Website,vetCare501,SN501,LowCost501,LowCost5012,respondToComplaints501,shelter501,euthanize501,rescueFosterSanctuary501,educate501,careAndTraining501,shelterSupport501,feralStrayTraps501,other501,Intake_Dog,Intake_Cat,Adoption_Dog,Adoption_Cat,Euthanasia_Dog,Euthanasia_Cat,SNFund,SNFund2" s-column="Euthanasia_Dog" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Euthanasia_Dog<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Euthanasia_Dog")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="42152" --></td>
	</tr>
	<tr>
		<td><b>Euthanasia_Cat:</b></td>
		<td>
		<!--webbot bot="DatabaseResultColumn" s-columnnames="ID,Addition/Correction,Proof,Focus,Focus1,Name,County,MailingAddress,MailingAddress2,City,State,ZipCode,PhysicalAddress,PhysicalCity,PhysicalAddress2,PhysicalState,PhysicalZipCode,Phone,Fax,Email,Website,vetCare501,SN501,LowCost501,LowCost5012,respondToComplaints501,shelter501,euthanize501,rescueFosterSanctuary501,educate501,careAndTraining501,shelterSupport501,feralStrayTraps501,other501,Intake_Dog,Intake_Cat,Adoption_Dog,Adoption_Cat,Euthanasia_Dog,Euthanasia_Cat,SNFund,SNFund2" s-column="Euthanasia_Cat" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Euthanasia_Cat<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Euthanasia_Cat")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="42198" --></td>
	</tr>
</table>
<hr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the end of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="62730" --></body></html>




rdouglass -> RE: Adding numbers in DB columns (1/31/2007 14:58:51)

Sorry, I should have mentioned you need to put it on a SPooky Diet (in the Database Tutorials section of this site).

http://www.outfront.net/spooky/adv_drw_diet.htm





spcafc -> RE: Adding numbers in DB columns (1/31/2007 15:30:20)

Thanks for the tip.

But before I do that I need to know where the code you suggested would go. I'll do the diet after I make sure everything works out.





rdouglass -> RE: Adding numbers in DB columns (1/31/2007 15:43:30)

quote:

I'll do the diet after I make sure everything works out.


Not with my code. [8|] My code that I'm suggesting *requires* that you diet the DRW or the code won't stay.




spcafc -> RE: Adding numbers in DB columns (1/31/2007 17:03:42)

Ok I see what you mean. Here's the diet version of the code. So where do I place your code?


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Adoption_Dog</title>
</head>
<body>

<!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<% end if %>
<%
fp_sQry="SELECT * FROM Organizations"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="db1"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&Addition/Correction=202&Proof=202&Focus=202&Focus1=202&Name=202&County=202&MailingAddress=202&MailingAddress2=202&City=202&State=202&ZipCode=3&PhysicalAddress=202&PhysicalCity=202&PhysicalAddress2=202&PhysicalState=202&PhysicalZipCode=3&Phone=202&Fax=202&Email=202&Website=202&vetCare501=202&SN501=202&LowCost501=202&LowCost5012=202&respondToComplaints501=202&shelter501=202&euthanize501=202&rescueFosterSanctuary501=202&educate501=202&careAndTraining501=202&shelterSupport501=202&feralStrayTraps501=202&other501=202&Intake_Dog=3&Intake_Cat=3&Adoption_Dog=3&Adoption_Cat=3&Euthanasia_Dog=3&Euthanasia_Cat=3&SNFund=202&SNFund2=202&"
fp_iDisplayCols=4
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<table BORDER="1">
<tr>
<td><b>Adoption_Dog:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Adoption_Dog")%>
</td>
</tr>
<tr>
<td><b>Adoption_Cat:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Adoption_Cat")%>
</td>
</tr>
<tr>
<td><b>Euthanasia_Dog:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Euthanasia_Dog")%>
</td>
</tr>
<tr>
<td><b>Euthanasia_Cat:</b></td>
<td>

<%=FP_FieldVal(fp_rs,"Euthanasia_Cat")%>
</td>
</tr>
</table>
<hr>
<!--#include file="_fpclass/fpdbrgn2.inc"-->
</body></html>




rdouglass -> RE: Adding numbers in DB columns (1/31/2007 20:10:12)

How 'bout this:

<html>

<%DIM totalA
totalA = 0%>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Adoption_Dog</title>
</head>
<body>

<!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<% end if %>
<%
fp_sQry="SELECT * FROM Organizations"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="db1"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&Addition/Correction=202&Proof=202&Focus=202&Focus1=202&Name=202&County=202&MailingAddress=202&MailingAddress2=202&City=202&State=202&ZipCode=3&PhysicalAddress=202&PhysicalCity=202&PhysicalAddress2=202&PhysicalState=202&PhysicalZipCode=3&Phone=202&Fax=202&Email=202&Website=202&vetCare501=202&SN501=202&LowCost501=202&LowCost5012=202&respondToComplaints501=202&shelter501=202&euthanize501=202&rescueFosterSanctuary501=202&educate501=202&careAndTraining501=202&shelterSupport501=202&feralStrayTraps501=202&other501=202&Intake_Dog=3&Intake_Cat=3&Adoption_Dog=3&Adoption_Cat=3&Euthanasia_Dog=3&Euthanasia_Cat=3&SNFund=202&SNFund2=202&"
fp_iDisplayCols=4
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<table BORDER="1">
<tr>
<td><b>Adoption_Dog:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Adoption_Dog")%>
<%IF trim(FP_Field(fp_rs,"Adoption_Dog") & "") > "" THEN
totalA = totalA + trim(FP_Field(fp_rs,"Adoption_Dog") & "")
END IF%>
</td>
</tr>
<tr>
<td><b>Adoption_Cat:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Adoption_Cat")%>
</td>
</tr>
<tr>
<td><b>Euthanasia_Dog:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Euthanasia_Dog")%>
</td>
</tr>
<tr>
<td><b>Euthanasia_Cat:</b></td>
<td>

<%=FP_FieldVal(fp_rs,"Euthanasia_Cat")%>
</td>
</tr>
</table>
<hr>
<!--#include file="_fpclass/fpdbrgn2.inc"-->
Total A = <%=totalA%>
</body></html>



See what I did? I just did the first one. I put a quick check with an IF..THEN to filter out blanks. If those items returned are numeric, you should see a Total A at the bottom.

That any help? Is that what you were looking for?




spcafc -> RE: Adding numbers in DB columns (2/1/2007 13:00:00)

It didn't do anything. It still returns the records individually.




rdouglass -> RE: Adding numbers in DB columns (2/1/2007 13:33:35)

quote:

It didn't do anything. It still returns the records individually.


I misunderstood a little regarding displaying only totals.

First however, did it put the total of A at the bottom? If that worked, we can easily remove the individuals.




spcafc -> RE: Adding numbers in DB columns (2/1/2007 14:35:42)


quote:

ORIGINAL: rdouglass

quote:

It didn't do anything. It still returns the records individually.


I misunderstood a little regarding displaying only totals.

First however, did it put the total of A at the bottom? If that worked, we can easily remove the individuals.


No.




rdouglass -> RE: Adding numbers in DB columns (2/1/2007 14:47:47)

Try this version:

<html>

<%DIM totalA,totalB,totalC,totalD
totalA = 0
totalB = 0
totalC = 0
totalD = 0%>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Adoption_Dog</title>
</head>
<body>

<!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<% end if %>
<%
fp_sQry="SELECT * FROM Organizations"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="db1"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&Addition/Correction=202&Proof=202&Focus=202&Focus1=202&Name=202&County=202&MailingAddress=202&MailingAddress2=202&City=202&State=202&ZipCode=3&PhysicalAddress=202&PhysicalCity=202&PhysicalAddress2=202&PhysicalState=202&PhysicalZipCode=3&Phone=202&Fax=202&Email=202&Website=202&vetCare501=202&SN501=202&LowCost501=202&LowCost5012=202&respondToComplaints501=202&shelter501=202&euthanize501=202&rescueFosterSanctuary501=202&educate501=202&careAndTraining501=202&shelterSupport501=202&feralStrayTraps501=202&other501=202&Intake_Dog=3&Intake_Cat=3&Adoption_Dog=3&Adoption_Cat=3&Euthanasia_Dog=3&Euthanasia_Cat=3&SNFund=202&SNFund2=202&"
fp_iDisplayCols=4
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->

<%IF trim(FP_Field(fp_rs,"Adoption_Dog") & "") > "" THEN
totalA = totalA + trim(FP_Field(fp_rs,"Adoption_Dog") & "")
END IF%>
<%IF trim(FP_Field(fp_rs,"Adoption_Cat") & "") > "" THEN
totalB = totalB + trim(FP_Field(fp_rs,"Adoption_Cat") & "")
END IF%>
<%IF trim(FP_Field(fp_rs,"Euthanasia_Dog") & "") > "" THEN
totalC = totalC + trim(FP_Field(fp_rs,"Euthanasia_Dog") & "")
END IF%>
<%IF trim(FP_Field(fp_rs,"Euthanasia_Cat") & "") > "" THEN
totalD = totalD + trim(FP_Field(fp_rs,"Euthanasia_Cat") & "")
END IF%>

<!--#include file="_fpclass/fpdbrgn2.inc"-->
Total A = <%=totalA%><br>
Total B = <%=totalB%><br>
Total C = <%=totalC%><br>
Total D = <%=totalD%>

</body></html>




That one any better? You should *only* see the totals for this one.

If it does not work as expected, could you post any error messages you see or perhaps a URL we could look at?




spcafc -> RE: Adding numbers in DB columns (2/1/2007 15:11:02)


quote:

ORIGINAL: rdouglass

That one any better? You should *only* see the totals for this one.

If it does not work as expected, could you post any error messages you see or perhaps a URL we could look at?


It worked - however the numbers are off. In the database any record without a number is filled with a zero. Would that make a difference?

http://www.spcafc.org/adoption_dog.asp




rdouglass -> RE: Adding numbers in DB columns (2/1/2007 15:16:10)

quote:

In the database any record without a number is filled with a zero.


That's a good thing since it may be treating them as text and not numeric. If so, we should be able to change the line(s) like this:

totalA = totalA + cint(trim(FP_Field(fp_rs,"Adoption_Dog") & ""))

See what I did? We would do that to each similar line. That strighten it out?




spcafc -> RE: Adding numbers in DB columns (2/2/2007 16:04:29)


quote:

ORIGINAL: rdouglass

[That's a good thing since it may be treating them as text and not numeric. If so, we should be able to change the line(s) like this:

totalA = totalA + cint(trim(FP_Field(fp_rs,"Adoption_Dog") & ""))

See what I did? We would do that to each similar line. That strighten it out?


I haven't had a chance to see if this works - FP now refuses to allow me to log on and publish. Was able to publish - and then not. The connect to website box just keeps popping back up after I click OK. I'm getting my hosting service to look into it on their end - hopefully it's their problem and not mine!

I'll ss what happens after this gets worked out.




spcafc -> RE: Adding numbers in DB columns (2/4/2007 19:12:09)


quote:

ORIGINAL: rdouglass

That's a good thing since it may be treating them as text and not numeric. If so, we should be able to change the line(s) like this:

totalA = totalA + cint(trim(FP_Field(fp_rs,"Adoption_Dog") & ""))

See what I did? We would do that to each similar line. That strighten it out?


Yes and no. If you go to the test page www.spcafc.org/adoption_dog.asp
You'll see that it's still pulling all the records up and the totals are at the bottom.

I'd like to just have the totals and not the individual records come up when the web page is loaded.




swoosh -> RE: Adding numbers in DB columns (2/4/2007 22:25:43)

Your gonna have to do some type of grouping to NOT display the individual records. I'm not sure exactly how that would be done in ASP. I'm sure Roger does.

However, if you just do a query in your database on the table, you can very easily group them in the query and then do a total count on each grouped field.

Then just display the results of the query.




rdouglass -> RE: Adding numbers in DB columns (2/5/2007 9:02:03)

quote:

You'll see that it's still pulling all the records up and the totals are at the bottom.


Did you use the code I posted? It should only post the totals.

Look closely at what I posted since it should only write the totals once if it is outside the DRW after the last include. If it is before the last include, you will get the results you're seeing.

If you are stuck, please post the DRW code you're using again.




spcafc -> RE: Adding numbers in DB columns (2/5/2007 10:43:38)

quote:

ORIGINAL: rdouglass

Did you use the code I posted? It should only post the totals.

Look closely at what I posted since it should only write the totals once if it is outside the DRW after the last include. If it is before the last include, you will get the results you're seeing.

If you are stuck, please post the DRW code you're using again.


Yes - however the totals are still off - by quite a bit. I did add the "cint()" info to the lines. I also checked the DB and the columns that I'm pulling the numbers from are formatted as Number so I'm not sure why it's doing this.




rdouglass -> RE: Adding numbers in DB columns (2/5/2007 13:03:56)

quote:

Yes - however the totals are still off - by quite a bit.


Can you change the query to grab a smaller set of data? Like for 1 day or 1 column to see if any of that is closer? It might help in disecting the problem. I don't know what data is in that table but you'd change the query here:

fp_sQry="SELECT * FROM Organizations"

That help any?




rdouglass -> RE: Adding numbers in DB columns (2/5/2007 13:04:40)

quote:

If you are stuck, please post the DRW code you're using again.


Also, can you post what you're using?




spcafc -> RE: Adding numbers in DB columns (2/6/2007 11:52:10)


quote:

ORIGINAL: rdouglass

quote:

Yes - however the totals are still off - by quite a bit.


Can you change the query to grab a smaller set of data? Like for 1 day or 1 column to see if any of that is closer? It might help in disecting the problem. I don't know what data is in that table but you'd change the query here:

fp_sQry="SELECT * FROM Organizations"

That help any?


Nope. Ugh. This is frustrating - it should be straight forward and simple!




spcafc -> RE: Adding numbers in DB columns (2/6/2007 12:01:37)

Ok I think I may have just found the problem - the number of records returned was set to 256 by default. Duh! I'm such a a dunce. Anyway I reset it 1000 records which is way more then I have but leaves plenty of room for more if that happens.

Roger - Thank You for helping me with this! If you want to see the finished project go to SPCA of Franklin County, North Carolina and check out the left hand column labeled "The Numbers so Far..."

It should be up and working by tomorrow (2/2/07)

Rebecca





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.171875