Class: ActiveReporter::Aggregator::CountIf

Inherits:
Count
  • Object
show all
Defined in:
lib/active_reporter/aggregator/count_if.rb

Instance Attribute Summary

Attributes inherited from Base

#name, #options, #report

Instance Method Summary collapse

Methods inherited from Base

#aggregate, #initialize, #sql_value_name

Constructor Details

This class inherits a constructor from ActiveReporter::Aggregator::Base

Instance Method Details

#default_valueObject



10
11
12
# File 'lib/active_reporter/aggregator/count_if.rb', line 10

def default_value
  super || 0
end

#functionObject



6
7
8
# File 'lib/active_reporter/aggregator/count_if.rb', line 6

def function
  "COUNT(#{expression} IN (#{values.map(&:to_s).join(",")}) OR NULL)"
end