I have a column in my crystal report(of VB.Net 2005),this column is a Balance where there's fo example '1000 C' or '1000D' in the page footer I want the sum of this column,since it's type is string because of the letters Cr and Db I created a formula,named SumBalance:
numberVar SumBalance;
SumBalance:=0;
whilereadingrecords;
if Right({StatOfAcc.Balance}, 1)="C" then
SumBalance=SumBalance-ToNumber(Left ({StatOfAcc.Balance},Length ({StatOfAcc.Balance})-2 ))
else
SumBalance= +ToNumber(Left ({StatOfAcc.Balance},Length ({StatOfAcc.Balance}) -2));
I had put this formula in the page footer it gave me False,and if I right click,
FormatObject,I find a tab Boolean,where did I specify that my formula is a boolean...Wher's my error...Plz Tell meI knew my wrong it's that I have to write
SumBalance := not SumBalance=
But this formula is not doing what I'm expecting to do,it give me the last Balance but I need the sum of all the line of the column Balance...|||You put the formula in the page footer, so it'll run once per page and it'll only work on the last record for the page.
If you move it to the detail section (where it should be to work on every record) you shouldn't reset SumBalance to 0 every time in the 2nd line, you should create a new formula for the page header to do this. You'll then need another formula for the page footer to display the balance.
Does a balance of 0 have either C or D after it?
Do you really want to subtract Credits and add Debits?
Your previous post said you had Cr or Db on the end of the balance, and this formula half says that too - you are checking the rightmost character for 'C' but then discarding the rightmost two characters to get the number.
And finally, what's the business logic in summing a balance field?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment