Skip to main content
Pentaho Documentation

util

pentaho.data. util

AMD Module

require(["pentaho/data/util"], function(util) { /* code goes here */ });

The util namespace contains functions for common tasks around dealing with data.

Source: javascript/web/pentaho/data/util.js, line 24

Methods

Name Description
buildRowPredicateNotAllNullColumns(columnIndexes) : function

Builds a row predicate function that tests if not all of the given columns contain a null value.

createFilterFromCellsMap(cellsMap, dataPlain) : pentaho.data.filter.Abstract

Creates a data filter from the given cells map and source data table.

createFilterIsEqualFromCell(dataPlain, columnId, cell) : pentaho.data.filter.IsEqual

Creates an IsEqual data filter having the given column and data cell value.

filterByPredicate(dataPlain, rowPredicate) : pentaho.data.ITable

Filters a plain data table given a row predicate and returns a resulting data view.

getCellValue(valueOrCell) : any

Gets the value of a cell, or value, directly.

getColumnIndexesByIds(dataTable, columnIds) : Array.<number>

Gets the array of column indexes given a data table and an array of column identifiers.

getFilteredRowsByPredicate(dataPlain, rowPredicate) : Array.<number>

Filters a plain data table given a row predicate and returns the resulting filtered row indexes.

hasAnyKeyColumns(dataTable) : boolean

Gets a value that indicates if a given data table has any key columns.

isColumnKeyEffective(dataTable, columnIndex, hasDataKeyColumns) : boolean

Gets a value that indicates if a column is an effective key.

isColumnTypeContinuous(dataType) : boolean

Gets a value that indicates if a given column data type has the continuous capability.

Methods Details

buildRowPredicateNotAllNullColumns(columnIndexes) : function

Builds a row predicate function that tests if not all of the given columns contain a null value.

Source: javascript/web/pentaho/data/util.js, line 233

Parameters:
Name Default Value Summary
columnIndexes : Array.<number>

The column indexes.

Returns:
Name Description
function

The row predicate function.

createFilterFromCellsMap(cellsMap, dataPlain) : pentaho.data.filter.Abstract

Creates a data filter from the given cells map and source data table.

Source: javascript/web/pentaho/data/util.js, line 117

Parameters:
Name Default Value Summary
cellsMap : Object.<string, (any | pentaho.data.ICell)>

The data cells map.

dataPlain : pentaho.data.ITable

The associated source, plain data table.

Returns:
Name Description
pentaho.data.filter.Abstract

A data filter.

createFilterIsEqualFromCell(dataPlain, columnId, cell) : pentaho.data.filter.IsEqual

Creates an IsEqual data filter having the given column and data cell value.

Returns null if the given columnId is not a defined column of dataPlain.

Source: javascript/web/pentaho/data/util.js, line 148

Parameters:
Name Default Value Summary
dataPlain : pentaho.data.ITable

The associated source, plain data table.

columnId : string

The column identifier.

cell : any | pentaho.data.ICell

The data cell.

Returns:
Name Description
pentaho.data.filter.IsEqual

An IsEqual data filter or null.

filterByPredicate(dataPlain, rowPredicate) : pentaho.data.ITable

Filters a plain data table given a row predicate and returns a resulting data view.

If all rows are selected, then the given plain table is returned, directly.

Source: javascript/web/pentaho/data/util.js, line 192

Parameters:
Name Default Value Summary
dataPlain : pentaho.data.ITable

The plain data table.

rowPredicate : function

A predicate function that, when given a plain data table and a row index, returns true to include the row and false to ignore it.

Returns:
Name Description
pentaho.data.ITable

The resulting table view.

getCellValue(valueOrCell) : any

Gets the value of a cell, or value, directly.

Source: javascript/web/pentaho/data/util.js, line 103

Parameters:
Name Default Value Summary
valueOrCell : any | pentaho.data.ICell

The value or cell.

Returns:
Name Description
any

The cell value.

getColumnIndexesByIds(dataTable, columnIds) : Array.<number>

Gets the array of column indexes given a data table and an array of column identifiers.

If any of the given column identifiers is not defined, null is returned.

Source: javascript/web/pentaho/data/util.js, line 163

Parameters:
Name Default Value Summary
dataTable : pentaho.data.ITable

The data table.

columnIds : Array.<string>

The column identifiers.

Returns:
Name Description
Array.<number>

The column indexes or null.

getFilteredRowsByPredicate(dataPlain, rowPredicate) : Array.<number>

Filters a plain data table given a row predicate and returns the resulting filtered row indexes.

If all rows are selected, then null is returned instead.

Source: javascript/web/pentaho/data/util.js, line 210

Parameters:
Name Default Value Summary
dataPlain : pentaho.data.ITable

The plain data table.

rowPredicate : function

A predicate function that, when given a plain data table and a row index, returns true to include the row and false to ignore it.

Returns:
Name Description
Array.<number>

The selected row indexes, or null.

hasAnyKeyColumns(dataTable) : boolean

Gets a value that indicates if a given data table has any key columns.

Source: javascript/web/pentaho/data/util.js, line 43

Parameters:
Name Default Value Summary
dataTable : pentaho.data.ITable

The data table.

Returns:
Name Description
boolean

true if there are key columns; false, if not.

See also: pentaho.data.ITable#isColumnKey

isColumnKeyEffective(dataTable, columnIndex, hasDataKeyColumns) : boolean

Gets a value that indicates if a column is an effective key.

A column is considered an effective key if isColumnKey returns true for the corresponding column or, in the case when the data table has no actual key attributes, if the attribute is categorical (see isColumnTypeContinuous).

Source: javascript/web/pentaho/data/util.js, line 73

Parameters:
Name Default Value Summary
dataTable : pentaho.data.ITable

The data table.

columnIndex : number

The column index.

hasDataKeyColumns : boolean
Optional

Indicates if dataTable, or its source table, contain any (real) key columns. Defaults to the result of calling hasAnyKeyColumns on dataTable. For performance reasons, if this method is being called repeatedly on the same data table, this value should be pre-calculated and specified each time.

Returns:
Name Description
boolean

true if the column is an effective key; false, if not.

isColumnTypeContinuous(dataType) : boolean

Gets a value that indicates if a given column data type has the continuous capability.

The data types "date" and "number" are considered continuous and all others categorical.

Source: javascript/web/pentaho/data/util.js, line 92

Parameters:
Name Default Value Summary
dataType : string

The data type name.

Returns:
Name Description
boolean

true if the data type is continuous; false, otherwise.