Skip to main content
Pentaho Documentation

IMicTable

IMicTable

The spec.IMicTable interface describes the structure of a specification of a table with a crossed structure, and, more specifically, a Measures In Columns crossed structure, or MIC, for short.

A table with a crossed structure is a table in which its structure (or layout) is not perfectly aligned with its model, but, instead, it is "cross-aligned". Conceptually, it can be viewed like this:

  • each horizontal line is associated with a distinct set of model entities, identified by a tuple of discrete attributes, that are said to be playing the "crossed-row" role
  • each vertical line is associated with another distinct set of model entities, identified by another tuple of discrete attributes, that are said to be playing the "crossed-column" role
  • the intersection of an horizontal and a vertical line:
    • is, thus, associated to the single model entity contained in the intersection of the horizontal and vertical entity sets (by construction, the intersection is considered to contain a single entity)
    • contains a tuple of continuous attributes, that are said to be playing the "crossed-measure" role

The actual table layout differs from this conceptual view and is what justifies the name MIC. It's organized as follows:

  • each row is associated to a distinct set of model entities
  • columns are divided in two sections (and thus each row as well):
    1. the first section contains a fixed number of plain columns, each corresponding, in order, to the attributes playing the "crossed-row" role
    2. the second section contains a variable number of columns, each corresponding to a distinct combination of:
      • a measure attribute playing the "crossed-measure" role, and
      • a cell tuple with the structure of the attributes playing the "crossed-column" role.

The layout property specifies the attributes that are playing each of the described crossed roles.

A crossed-layout can have any number of attributes in any its roles.

Properties:
Name Default Value Description
version : number

The version of the table specification format.

Currently, the only possible value is 3.

When unspecified, the latest version known by the interpreter is assumed.

model : pentaho.data.spec.IModel

The model specification.

Can be empty or not be specified at all.

layout : pentaho.data.spec.ICrossedStructure

The structure (or layout) of the crossed table.

cols : Array.<pentaho.data.spec.CrossedColumn>

An array of column specifications.

Indexes less than the number of row attributes, as specified in layout.rows, must contain plain column specifications, pentaho.data.spec.PlainColumn, while greater indexes must contain MIC column specifications, pentaho.data.spec.MicColumn.

When the table has column and/or measure attributes, as specified in layout.cols and layout.meas, it is required to specify at least as many column specifications as there are row attributes.

rows : Array.<pentaho.data.spec.Row>

An array of row specifications.

Can be empty or not be specified at all.

Source: doc-js/pentaho/data/spec/IMicTable.jsdoc, line 17

Example

A "Measures In Columns" cross table specification

 var micTableSpec = {
 model: [
 "family",
 "product",
 "year",
 {name: "sales", type: "number"}
 ],
 layout: [
 rows: ["family", "product"],
 cols: ["year"],
 meas: ["salesAmount", "salesQty"]
 ],
 cols: [
 "family",
 "product",
 {attr: "salesQty", c: [2013]},
 {attr: "salesAmount", c: [2013]},
 {attr: "salesQty", c: [2014]},
 {attr: "salesAmount", c: [2014]}
 ],
 rows: [
 {c: ["cars", "bmd-i100", 2, 500000, 3, 800000]},
 {c: ["cars", "fiord-feast", 120, 5000000, 60, 2200000]},
 {c: ["plains", "bing-123", null, null, 20, 85000000]}
 ]
 };