Creating Totals

I need to create two seperate totals based upon the same field, but using different filtering criteria. (Confused ?? I am !!) What I need is this : Field 1 := “Entry Type”; Field 2 := "Invoiced Quantity "; Total a := Sum(Field2); Total b := Sum(Field2,where(Field1=Field1::Sale); I know that “Currreport.Calcfields” will not work in this situation as I need to use different filtering. Any suggestions ??

Ralph: I do not think that a second dataitem is possible in this case. I need the totals to appear on the same section of the report. I would like to use the C/AL alternative, but I am not sure what command to use.

??? //OnAfterGetRecord trigger: SecondDataSource.RESET; SecondDataSource.COPY(PrimaryDataSource); PrimaryDataSource.COPYFILTERS(SecondaryDataSource); SecondDataSource.SETRANGE(“Field”, NewFilterValue); //… //… SecondDataSource.CALCFIELDS(“Some FlowField”); //… Business Applications Programmer Sertified Navision Developer SIA “Sintegra” Latvia

Check out CALCSUMS. As long as the field being summed is defined as a SumIndexField for the current key and the fields used to filter the table are all members of the current key then CALCSUMS will return the desired result.

As Jack said, CALCSUMS is probably the way to go here. CALCFIELDS will only work if you have a FlowFilter set up for “Entry Type”. Chris Krantz NCSD,NCSQL,MCSD,MCSE Microforum Inc. Toronto, Ontario, Canada

Okay, I appreciate that CalcSums is the way forward, but just to add increased difficulty, I need to group first and then do the totalling. Can this be done using calcsums ?

I would suggest as a starting point that you have two seperate flow fields, one for each sum total. What is it that you actually need to “Group first”. _________________________ David Singleton Navision Consultant since 1991 dmks22@home.com___________ Edited by - David Singleton on 2001 Sep 25 17:14:02

Dean, as i can see you’re trying to get totals by field type and a general total of all of them. Without too much troubles you can use as follows: a) group by Field1 (entry type); b) define a decimal variable (example totalA) for the end total. c) OnBeforeSection on the groupfooter of the dataitem (where it shows the totals), remember to use TotalA += Field2; (remember first that you’ve to totalize field2 for getting the group total). d) Create a footer section that will only be printed at the end of document and print there the totalA value. Regards – Alfonso Pertierra apertierra@teleline.es Spain Western Computer Los Angeles, California

If you have structured your report to run through all Item Ledger Entries with a Invoiced Qty <>0 for a specific period … You can always use two variables //OnAfterGetRecord Qty1 := “Invoiced Quantity”; IF “Entry Type” = “Entry Type”::“Sale” then Qty2 := “Invoiced Quantity” else Qty2 := 0; And then use CREATETOTALS in the correct OnPreDataItems triggers to generate the totals ans subtotals. //OnPreDataItem Currreport.CREATETOTALS(Qty1,Qty2); A report running through all entries like this instead of using flowfields can be slow. It all depends on what the intention of the report is. This may be good enough for a Daily, Weekley, Monthly Sales report, all depending on the No. of Transactions you have. But if you start going into Year to Date figures and things like that it might be slow, again all depending on how many transactions you have. Then you should define new or try to make use of existing flowfields. Best regards/Med vänlig hälsning/Kveðja/Med venlig hilsen/Mit freundlichen Grüssen Johan Emilsson

You could also try using 2 different dataitems followed by a dataitem assigned to the interger table (maxinteration=1). Use the integer dataitem to display both totals. Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117