avg rather than sum in demo 3.frf

canobobcanobob Spain
edited 7:16AM in FastReport 2.xx VCL
Hi!
Can some one tell me why if I change the Sum for AVG in demo fr3 the memo28 on the sencond groupfooter (Band7) allway shows 0?


In my Application I have a report that does more or less the same as this report except that the values are AVG rather than SUM

Thank

Roberto

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 7:16AM
    Possibly because there is no avg function in the function list.
    However please post questions about Fr3 in the Fr3 forum.
    ;)
  • canobobcanobob Spain
    edited 7:16AM
    gordk wrote:
    Possibly because there is no avg function in the function list.
    However please post questions about Fr3 in the Fr3 forum.
    ;)
    I??m not talking about fastreport3 but fr3.frf in the demo directory
    (IE: frdemo.EXE)
  • gordkgordk St.Catherines On. Canada.
    edited 7:16AM
    sorry about that
    First Avg requires a band name parameter and second it must be in correct footer
    so it would look like
    [AVG(varname]*[varname,nameofmdband)] and be placed in the innergroup footer not the outerfooter since we are working with variables that have expression values belonging to the group
    you could also use [AVG([parttotal],bandname)] and get the same result.
    ;)
  • canobobcanobob Spain
    edited August 2004
    gordk wrote:
    sorry about that
    First Avg requires a band name parameter and second it must be in correct footer
    so it would look like
    [AVG(varname]*[varname,nameofmdband)] and be placed in the innergroup footer not the outerfooter since we are working with variables that have expression values belonging to the group
    you could also use [AVG([parttotal],bandname)] and get the same result.
    ;)
    Thank for the prompt reply!
    But ...Maybe is my English....
    I know how to get the Avg in the inner group, my problem is getting the AVG for the outer.

    to keep to the example FR3.FRF :
    Let say that I need to get the Avg of the total sale of a customer in the outer band
    next to "Total sales this customer: [Sum([Part total])]$"
    something like ...[AVG([Memo15],Band8)] but ussing this I get 0!

    in other word I need the average sale for a customer.

    Sorry if I can not explaing it proprely!

    Thank
    roberto
  • gordkgordk St.Catherines On. Canada.
    edited 7:16AM
    Hi Roberto
    what you want is average per invoice.
    so you have to count the number of times the innergroupheader appears for each customer.
    in opb of first groupheader band4
    mycount := 0;
    in obp of 2 groupheader
    inc(mycount);
    in memo in outer footer band7
    SUM([Part total], Band6, 1)] / [mycount
    ;)
  • canobobcanobob Spain
    edited 7:16AM
    gordk wrote:
    Hi Roberto
    what you want is average per invoice.
    so you have to count the number of times the innergroupheader appears for each customer.
    in opb of first groupheader band4
    mycount := 0;
    in obp of 2 groupheader
    inc(mycount);
    in memo in outer footer band7
    SUM([Part total], Band6, 1)] / [mycount
    ;)
    thank!!

    this work ok

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.