canoerandy
Posts: 2
|
Posted: 07/24/2008, 12:31 PM |
|
I am trying to sum a total of dollar values on a grid.
I am using an example found on this system, placed in the BeforeShow event of the grid:
MyGrid.Summ.Value = MyGrid.Summ.Value + MyGrid.Dollar.Value
The problem I am having is that this just adds the numbers together but doesn't give me the correct number if there is a negative amount. If I export the grid results to a spreadsheet and total it I get the correct information. But this method of summing gives me the wrong numbers.
Could someone show me how to correctly write out a summing function on this please?
Thanks,
Randy
|
|
|
wkempees
Posts: 1679
|
Posted: 07/26/2008, 3:30 AM |
|
I am not into ASP, but.....
What type is your MyGrid.summ.Value?
See if it is 'signed'.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
|
|
Oper
Posts: 1195
|
Posted: 07/27/2008, 3:22 PM |
|
are you summing a field that mask colors to display? like red for negative?
if that teh case then try for test first a simple masking #0.00
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
canoerandy
Posts: 2
|
Posted: 07/30/2008, 11:48 AM |
|
I'm not sure what wkempees is refering to, the field is numeric data.
Oper - yes I do have a mask on the field, I took it off and had the same results. I also am using alternating color rows and I dropped the second row and re-published and had the same results.
I am at a loss as to why this is happening. If I sum the raw data and compare it to data copy/pasted from the published page the numbers match. They do not match the sum created on the fly with this grid. I know I could just create another grid from an Access query and populate another grid on the page but that would defeat any additional filtering that I have built into the page. So that is not an option.
Another strange thing that I noticed and this might spark a memory with someone, just not me... If I re-sort the grid results on the published page by any of the other header links I get different numbers in the sum. That really baffles me...
Thanks for all your help!!!
Randy
|
|
|
Oper
Posts: 1195
|
Posted: 07/30/2008, 7:56 PM |
|
Randy
1) could you please Take SS of the property of that Field and post here?
2) Could you paste the Code that you are using on before show?
3) Could you please use small number of record let said 5 records
and post here each value and the odd result you get?
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
paulolg
Posts: 7
|
Posted: 03/23/2009, 2:45 PM |
|
Hi,
Try to resolve the sum in the SQL, for example:
select a,b,c from table
union
select 'sum','',sum(c) as total from table
so, the result will be something like this.
row1 x y z
row2 w e r
...
rowN 'sum' sum(c)
let me know if it works
regards,
paulolg
|
|
|
|