Perhaps this is not the proper way to approach this problem, so please
correct me if I am doing something silly.

I have a fact model that performs two aggregates on the same field.
Basically my motivation is to calculate the mean and standard deviation of
one fact field.  Here's an example of the fact table aggregates:

class SomeFact < ActiveWarehouse::Fact
  aggregate :hours_duration, :type => :avg, :label => "Mean (Hours)"
  aggregate :hours_duration, :type => :stddev, :label => "StdDev (Hours)"
end


When I try to create a TableReport that uses this fact table, I am having
some problems specifying which aggregate I want when defining :format or
:fact_attributes.  For instance:

@report = ActiveWarehouse::Report::TableReport.new(
  . . .
  :format => {
    :hours_duration => Proc.new {|value| sprintf("%.2f", value)}
  },
  :fact_attributes => [:hours_duration]
)


The problem with :format is obvious. . . if I wanted to display the mean
with two decimal places and the standard deviation with four decimal places,
I can't find a way to specify which 'fact field' to apply which format to.
The :fact_attribute has a similar problem. . . if I want to see the mean and
standard deviation fields, there is no way to list both in the
:fact_attributes because they share a 'field name'.

Am I overlooking something obvious here?  I looked at the AW code and it
appears to always fetch the aggregate field by its field name in the table.
Is there a way to apply another identifier to an aggregate so that I can
discriminate between them?

Cheers,
Andy K.
_______________________________________________
Activewarehouse-discuss mailing list
Activewarehouse-discuss@rubyforge.org
http://rubyforge.org/mailman/listinfo/activewarehouse-discuss

Reply via email to