Skip to content

ActiveRecord::Olap::TableHelper

wvanbergen edited this page Sep 12, 2010 · 5 revisions

This module contains functions to display OLAP cubes using HTML tables. Before you can use these methods, make sure that the module is included as helper module so the methods are available in your views:


class MyOlapController < ActionController::Base
helper ActiveRecord::Olap::TableHelper

end

active_olap_table(cube, options = {}, html_options = {})

Displays the complete cube in a HTML table, using a row for every dimension category combination possible. This method works for cubes with as many dimensions as you like, and it supports multiple aggregate functions, whose results will be displayed in cells next to each other.

Parameters

  • cube: The ActiveRecord::Olap::Cube instance that was returns by a call to olap_query.
  • options: A hash that can be used to control the structure of the resulting table. Currently, no options are supported, so this is reserved for future use.
  • html_options: A hash with attributes that will be added to the table-tag.

active_olap_matrix(cube, options = {}, html_options = {})

Displays a two dimensional cube as a table, using the categories of the first dimensions as rows and the categories of the second dimension as columns. Currently, this function only works when only a single aggregate function is used.

Parameters

  • cube: The ActiveRecord::Olap::Cube instance that was returns by a call to olap_query. Note that this function will raise an exception if the cube does not have exactly two dimensions.
  • options: A hash that can be used to control the structure of the resulting table. Currently, no options are supported, so this is reserved for future use.
  • html_options: A hash with attributes that will be added to the table-tag.