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 8:45AM
    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 8:45AM
    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