Can you sort the report by a group average?

hsmhsm
edited September 2013 in FastReport 4.0
For simplicity I'll use dummy field names about drawers containing socks as the actual sql supplying the report runs to several pages (and does not involve socks)!

I would like to make an ordinary grouped report that shows eg

Name, DrawerID, NumberOfSocksInDrawer, NumberOfRedSocksInDrawer

The report will be grouped by Name with the average number of red socks that person owns shown in the group footer. That will be a calculated memo using the [100*sum(NumberOfRedSocksInDrawer) / sum(NumberOfSocksInDrawer)
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->Fred 
   DrawerID   NumSocks   NumRedSocks
      3         50         10
      4         60         20
      5         10          5 
Average num red socks for Fred 29.1%

Jim 
   DrawerID   NumSocks   NumRedSocks
      1        10          5
      2         20         8
Average num red socks for Jim 52.6%<!--fontc--></span><!--/fontc-->

What I'd like to do is have the report show the groups in order of the average number of red socks, so in this example Jim's group will appear before Fred's group

Is this possible, if so how?

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 5:25AM
    fr does not sort data, it only groups according to what you have presented to it.
    So you must do your sorting and calculating within your queries
  • hsmhsm
    edited 5:25AM
    gordk wrote: »
    fr does not sort data, it only groups according to what you have presented to it.
    So you must do your sorting and calculating within your queries
    OK, Thanks gordk, I'll have to calculate the average within the sql then.

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.