How to obtain a value within a report

tazzy30tazzy30 Member Posts: 52
I have created a Report to count Shipment headers and lines, I now want to loop through the lines to create a Total Value of all the Sales Shipment Lines on the report but i'm not sure what code to put in.

Can anyone help?

Thank You

Comments

  • michaelmmichaelm Member Posts: 20
    If you create a Global "TotalAmount" as a decimal.

    Then in the data item enter

    TotalAmount := TotalAmount+"Shipment lines" ;

    In the sections enter a footer with a text box. I properties ad the source expression "TotalAmount".

    Regards
    Michael M
  • kapamaroukapamarou Member Posts: 1,152
    Or use
    CurrReport.CREATETOTALS(MyDecimalVariable);
    
  • tazzy30tazzy30 Member Posts: 52
    Thank you both for your replies.

    I used Michael's solution which works fine, but when i do the same for Sales Credit Memo's (same report different data item) I get the inccorect total, would it need to be calculated differently?
  • kapamaroukapamarou Member Posts: 1,152
    You have to be careful.

    If you manually calc the totals, then if at some section you have SHOWOUTPUT(..)
    then you might get unprinted records that participate in the total. You have to look at the general picture of the report mechanism to figure out what to do.

    You could also move your code at a post section trigger. Also if you need to print totals in Groupfooters and TransferFooters (or headers) you might end up with wrong results...
Sign In or Register to comment.