Truncate
Click here if you want to read this article for the latest version.
Piwik\DataTable\Filter\
Truncate
Truncates a DataTable by merging all rows after a certain index into a new summary row.
The ReplaceSummaryRowLabel filter will be queued after the table is truncated.
Examples
Basic usage
$dataTable->filter('Truncate', [$truncateAfter = 500]);
Using a custom summary row label
$dataTable->filter('Truncate', [$truncateAfter = 500, $summaryRowLabel = Piwik::translate('General_Total')]);
Methods
The class defines the following methods:
__construct()— Constructor.filter()ash; Executes the filter, see Truncate.enableRecursive()ash; Enables/Disables recursive filtering. Inherited fromBaseFilterfilterSubTable()ash; Filters a row's subtable, if one exists and is loaded in memory. Inherited fromBaseFilter
__construct()
Constructor.
Signature
It accepts the following parameter(s):
$table(DataTable) —$truncateAfter(int) — The row index to truncate at. All rows passed this index will be removed.$labelSummaryRow(string) — The label to use for the summary row. Defaults toPiwik::translate('General_Others').$columnToSortByBeforeTruncating(string) — The column to sort by before truncation, eg,'nb_visits'.$filterRecursive(bool) — If true executes this filter on all subtables descending from$table.
filter()
Executes the filter, see Truncate.
Signature
It accepts the following parameter(s):
$table(DataTable) —
It does not return anything or a mixed result.
enableRecursive()
Enables/Disables recursive filtering. Whether this property is actually used is up to the derived BaseFilter class.
Signature
It accepts the following parameter(s):
$enable(bool) —
It does not return anything or a mixed result.
filterSubTable()
Filters a row's subtable, if one exists and is loaded in memory.
Signature
- It accepts the following parameter(s):
$row(Row) — The row whose subtable should be filter.
- It does not return anything or a mixed result.