Hi How do I sum up all values from the field Amount in frm 20 ‘General Ledger Entries’ ? I want to make a new field at the bottom of the screen, which shows the sum of the Amount field for all records in the current view. I know that this design doesnt follow the standard design, but this is not the issue here ;-)) Of course, if the user filters on another date, document number etc the new field must show the sum of the shown records. Best regards Streg, newbie
As long as you cannot work with SIFT this is a quite heavy (time consuming) task. One way would be to run an external “OCX” which sets a SUM statement via ODBC. Also quite difficult as you have to create that statement first. And then you might get problems with user rights :S Do you need this field always to be displayed ? Or could it be some kind of statistic (like F9) ?
… I want to make a new field at the bottom of the screen, which shows the sum of the Amount field for all records in the current view. I know that this design doesnt follow the standard design, but this is not the issue here ;-)) …
Originally posted by Streg - 2005 Feb 07 : 15:30:32
Hmm, the good old BLUE times [V]. It was standard in the blue Navision versions that all sum fields of the filter were shown in the bottom of the window… Don’t know why this nice and good feature is gone with the wind… So we have to live with work arounds: I use a hidden Excel instance to summarize numeric / decimal fields. If the user pushs a button all marked records are copied to the hidden Excel instance. Then the system checks the field content. If the content is numeric or decimal the header is added to a string. With this string I run strmenu to choose the field to summarize. Then I get the sum [^] (and a question if I want to summarize another field). It is difficult to explain but it works very well. bye André
Yes, the customer was recently upgraded from old blue Navision to 3.70, so of course everything must look like the old version… I have found a solution that seems to work. I have made a new function CalcAmountSum in the form, which is called from a new text-control with SourceExpr=CalcAmountSum. Code looks like this:
AmountTemp := 0; ViewString := Rec.GETVIEW; IF ViewString <> '' THEN BEGIN GLEntries.RESET; GLEntries.SETVIEW(ViewString); IF GLEntries.FIND('-') THEN BEGIN REPEAT AmountTemp := (AmountTemp + GLEntries.Amount); UNTIL (GLEntries.NEXT = 0); END; END; EXIT(AmountTemp); There seems to be no speed-issues, even with many entries. And the new field is updated correctly, if user filters on some other fields too. /Lars