Options

Total a column in a report

demi222demi222 Member Posts: 131
For report 202 can someone help me on making totals? First of all I am having a difficult time understanding the dummy data items...

I want to total 4 columns in the Roundloop Body section.

One is the SalesLine.Quantity. The second one is SalesLine.LineDiscountAmount
and the third one is:
SalesLine.Amount Including VAT.

I know this is probably easy, but I have spent a lot of time trying to do this. I am new to programming and navision.

Can anyone help me?

Comments

  • Options
    ArhontisArhontis Member Posts: 667
    Hi,

    To total fields in a report is relatively easy. You enter the fields in the TotalFields propery of a dataitem, and place textboxes with source expression to that fields in a footer section of that dataitem.

    In your case, it is difficult because the Roundloop dataitem is an integer one.

    All you have to do is create 3 decimal variables, make them zero on the OnPreDataItem of the Roundloop, and in the OnAfterGetRecord do the summing to that variables with code.

    Then in a footer section of Roundloop place textboxes with source expression to that variables.

    I took a look at the report and it is a bit complicated, make sure that the information you need isn't already calculated.

    :-k
  • Options
    demi222demi222 Member Posts: 131
    ok, I made three global variables:

    TotalQuantity
    TotalDiscountAmount
    TotalLineAmount

    all of type decimal.

    I added a roundloop footer and placed a textbox with source expression of TotalQuantity.

    On Pre Data Item of Roundloop I set the variables to 0.

    On After Get Record of roundloop the code I have added is:
    IF "Sales Line".FIND THEN
    TotalQuantity := "Sales Line".Quantity;

    this, however gets the last record's quantity.

    I then tried using "Sales Line".NEXT and this didn't work either.

    I don't know how to sum them up.
  • Options
    demi222demi222 Member Posts: 131
    I got it!!

    I should have done TotalQuantity := TotalQuantity + "Sales Line".Quantity.

    Thanks for your help!!
Sign In or Register to comment.