Total on a Decimal Field

MclarenMclaren Member Posts: 47
Hi Guys,


I am confused on How to get the Total for a Decimal Variable in the Report. For Example I have created a Decimal Variable call DecimalVariable.


DecimalVariable := A + B ;


How to get the Total of that DecimalVariable from the Report? Plz help on this.


Thanks in advance.

Comments

  • nvermanverma Member Posts: 396
    Put your variable (DecimalVariable) in the body or header section of the report. So, whaterever value is stored in the field will be refelected in the report.
  • MclarenMclaren Member Posts: 47
    Hi nverma. Thanx for ur reply. I just need the total of that Decimal Variable. Not the Decimal Value. Thats what I am asking for.
  • nvermanverma Member Posts: 396
    The total is stored in the variable itself (DecimalVariable).
  • MclarenMclaren Member Posts: 47
    Yes u r Correct. If we tell like this.


    1st A+B = 20
    2nd A+B = 35
    3rd A+B = 40
    4th A+B = 72
    5th A+B = 50

    Here I have 5 records.
    So I have print that Total as 20 + 35 + 40 + 72 + 50 = 217. This is what I am asking. HOw to get the Total?
  • nvermanverma Member Posts: 396
    Try something like this:
    Sum (text)
    Make a field called: Total (decimal):= 1st+2nd+3rd+4th +5th;
    or
    Sum := "%1 + %2 + %3 + %4 +%5 = %6", 1st, 2nd, 3rd, 4th, 5th, Total ;

    I havent tested it, but it should be something around those lines.
  • jspoppjspopp Member Posts: 54
    Hi,

    create a global variable (in this case DecVar) of type decimal. In the appropriate DataItem, place code in the OnAfterGetRecord section like:

    DecVar:= 0;

    DecVar := DecVar + SalesInvLine.Amount;

    Then use DecVar as your SourceExpr in the textbox. You probably don't want to add processing type code in the sections area of your report. Run your report through the debugger so you can get an idea of how the calculations work for you. Good luck with this.
  • MclarenMclaren Member Posts: 47
    Thank You Guys for Your Reply on this. I got some idea on it and trying to work it out. Thank You for Your Kind Help.
Sign In or Register to comment.