Class pvc.options.DimensionsReader
Constructor Attributes | Constructor Name and Description |
---|---|
The options documentation class of a data dimensions reader.
|
Field Attributes | Field Name and Description |
---|---|
General | |
The index or indexes of the columns that the reader reads
from each
logical row.
|
|
The name or names of the dimensions that the reader reads
from each
logical row.
|
Method Attributes | Method Name and Description |
---|---|
General | |
reader(logicalRow, outAtoms)
A dimensions reader function,
reads the values of dimensions,
for each
logical row.
|
A dimensions reader is executed for each row of a data source to convert values of one or more columns into one or more atoms of certain dimensions.
Together, a set of dimensions readers, are executed to fully convert each data source row into atoms of the defined dimension types. The atoms of each row are used to construct a datum.
The mentioned data source row is called the logical row. Depending on the data source format (crosstab or relational), the actual rows carry different informaton. The logical row is a normalized view of each row of the data source, independent of its format.
A dimensions reader can be configured in the following ways:
- specify names but not reader
- names are paired with any specified indexes, from left to right; excess indexes feed dimensions whose name starts with the last specified name (a dimension group); excess names are fed with the non reservedindexes that follow the last specified index (or 0, if none); indexes explicitly specified in dimensions readers are all reserved beforehand
- specify indexes but not names and reader
- the specified indexes become reserved but are not read, and so are effectively ignored
- specify both reader and names
- any specified indexes are reserved, and no pairing is performed between these and the specified names; the reader function may read any column from the logical row and return atoms from any of the dimensions specified in names; atoms of stated dimensions, that are not returned, result in a null value; this form allows, for example, splitting a value in the logical row into two dimensions.
Only one dimensions reader can state that it reads a given index (although a dimensions reader function may sneek into any columns it likes).
When the argument is a string, it can be a list of names, separated by the character ",".
Only one dimensions reader or dimensions calculation can read or calculate a given dimension.
When unspecified, one is created that performs a simple mapping between the specified names and indexes.
A dimensions reader function can be specified to perform non-simple operations over the read columns, like the following:
- combine values from two or more columns into a single dimension,
- split the value of one column into more than one dimension,
- feed a dimension with correlated data read from an external data source.
Dimensions reader functions need not be specifed to perform conversion or formatting operations of a single column. For those cases, the dimension type's DimensionType#converter and DimensionType#formatter are more appropriate.
Also, when the value of a dimension is calculated from the value of other dimensions, a dimensions calculation may be more appropriate: see DimensionsCalculation.
The function may read columns whose indexes were not "reserved" in indexes. Those columns might be read by other readers, possibly default ones created by the translator.
- Context:
- {pvc.data.Data}
- Arguments:
- {list(any)} logicalRow
- The logical row array.
- {object} outAtoms
- An object that should be filled with read raw values,
each placed in a property with the name
of the corresponding dimension.
It is also possible that the values be the atoms themselves, a technique that can be used to achieve greater performance, when a dimension only has two or three possible values.
- Returns:
- {undefined}