|
| |
|
|
hzarabet
Posts: 1540 From: New Milford CT USA Status: offline
|
Getting the sum of a field - 3/26/2001 23:41:00
I have a field named "Price". If there are numerous records, I would like to get a grand total for all the individual prices.Do I need to set up a new database to achieve this? Is there an asp code I can use based on the database results <%=FP_FieldVal(fp_rs,"price")%> (these are the individual record prices)? I did a search and found <%SumTotal = SumTotal & FPField_val("Price")%>,but it didn't work. My SQL book says SELECT SUM(Price) from ad_proposal but the DRW doesn't even create a results field. Hmmmm? ------------------ www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
Spooky
Posts: 26606 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Getting the sum of a field - 3/27/2001 20:22:00
Try :<%SumTotal = SumTotal + cInt(FPField_val("Price"))%>
|
|
|
|
hzarabet
Posts: 1540 From: New Milford CT USA Status: offline
|
RE: Getting the sum of a field - 3/27/2001 20:19:00
Tried it...error message:Microsoft VBScript runtime error '800a000d' Type mismatch: 'FPField_val' /advertisers.asp, line 276
------------------ www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
hzarabet
Posts: 1540 From: New Milford CT USA Status: offline
|
RE: Getting the sum of a field - 3/27/2001 23:32:00
There are numbers in the field, listed as "numeric" on the SQL table, not text.------------------ www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
hzarabet
Posts: 1540 From: New Milford CT USA Status: offline
|
RE: Getting the sum of a field - 3/28/2001 16:02:00
Subtle bump.------------------ www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
Spooky
Posts: 26606 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Getting the sum of a field - 3/28/2001 19:48:00
Oh sorry  How about this one?FPField_val is the actual correct function code? or is it FP_FieldVal(fp_rs,"price")? <% RowTotal = FP_FieldVal(fp_rs,"price") SumTotal = SumTotal + RowTotal %>
|
|
|
|
hzarabet
Posts: 1540 From: New Milford CT USA Status: offline
|
RE: Getting the sum of a field - 3/28/2001 20:37:00
No, nothing is appearing at all. No error message, just blank (Prices are filled in, should total $500).On top of that if, I have moved the last of the three "include statements" below my PayPal button to stop the : Microsoft VBScript runtime error '800a000d' Type mismatch: 'rs' /_fpclass/fpdblib.inc, line 12 error. But, now when database reults are greater than 1 record, my whole dtatbase is reconfigured all wacky, so this is another question. I also need to use this "sum statement" outside of the database include statements. I hope I am phrasing this correctly! Thanks again ------------------ www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
Spooky
Posts: 26606 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Getting the sum of a field - 3/28/2001 21:01:00
You are writing SumTotal on the page somewhere?That can be placed anywhere outside (below) the DRW <%=SumTotal%>
|
|
|
|
hzarabet
Posts: 1540 From: New Milford CT USA Status: offline
|
RE: Getting the sum of a field - 3/29/2001 20:35:00
But I am still just getting a blank response from <% RowTotal = FP_FieldVal(fp_rs,"price") SumTotal = SumTotal + RowTotal %> There definitely are NUMBERS in my price field (not text)
|
|
|
|
Spooky
Posts: 26606 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Getting the sum of a field - 3/30/2001 20:36:00
If you write <%= FP_FieldVal(fp_rs,"price")%> You must get a priceIf you write <% RowTotal = FP_FieldVal(fp_rs,"price") Response.write RowTotal %> You must get the same value Now the same theory applies <% RowTotal = FP_FieldVal(fp_rs,"price") SumTotal = SumTotal + RowTotal %> Are you writing them somewhere or how do you tell they are blank?
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|