Sum a memo from Group Detail Footer in the Footer

phcphc
edited March 2014 in FastReport 4.0
I am trying to Sum a Memo value from the group detail footer in the Footer but I keep getting a repeat value of the memo based on the number of line items in the following group

eg

Lets say there is groups A,B,C

Group Footer
Memo1 = [Memo2.Value - Memo3.Value] , This works as predicted Lets say result = 5 ( I Also have a IIF group = in memo 1 also so this value does not show in all groups )

Footer
Memo4 = [SUM( Memo1.Value )] , This would Give 5 ( From Memo1 ) * the number of line items in the next group. eg if there were 10 item in the following group would return 50 rather than the 5 that I am looking for
I have also tried the Options in SUM of DataDetail1, 1,2 & 3

I need to do it this way because if one of the groups has an option set then the Group total is re-calulated and I need to reflect that in the total value so I cant use the DB values

This is the actual value of the Memo1 in the above example ( Memo9 is the new calculated value )
[Memo9.Value - SUM(<frdPrintGroup."LineTotal">,DetailData1)] this give the desired result

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 8:50AM
    you need to understand how the report engine processes objects
    1 top down depending on band type.
    2 left to right in order of creation within the band.
    3 the value method of a memo only returns the value of the last expression in the memo.

    "Memo1 = [Memo2.Value - Memo3.Value] ," this would produce an error value
    as memo1 is processed before memo2 or memo3
  • phcphc
    edited 8:50AM
    I was only using Memo1/2/3 for the example

    On the DetailData1 Band I have GroupFooter1 which contains the following
    Memo9 with either the db/calculated total depending on the group - This gives the desired result
    Memo50 which calculates the difference between the db and calculated totals - This also gives the desired result

    On Footer1
    Memo55 which I want to have the sum of Memo50 - This does not, Memo50s value is multiplied by the number of items in the next group eg if total was 5 for group A and then there were 6 items in group B it would multiply the answer eg 5 x 6 = 30 , if there were 8 items in group B it would be 5 x 8 = 40 rather than the correct sum in this example of 5
  • gordkgordk St.Catherines On. Canada.
    edited 8:50AM
    can you post a copy of your .fr3 and the output .fp3 file ?
    what db engine are you using and what version of fr4

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.