Configuration and Integration
Loading Conditions
The Report Builder services load when the bundles they depend on are present:
- The Generic Data Index bundle: the field catalog, validation and the report runner.
- The Pimcore Studio backend: the Report Builder endpoints and the extension points of the Pimcore Studio UI.
- The Custom Reports bundle: the
reportBuildercustom report adapter.
The Generic Data Index is a required dependency of the bundle, see the requirements.
Generic Data Index
The Report Builder runs every search through the search services of the Generic Data Index with the view
permission of the user. It does not read the database.
Workspace Matching
The Generic Data Index version is listed in the requirements. It is ^2026.4 because
reports need a release in which a search with the view permission matches elements only by their
own workspace permissions. The parent paths of the allowed workspaces are part of list searches only, which the tree
uses. Otherwise aggregations of non-administrators would count folders and parent elements the user may not view.
Workflow Places
The place of a workflow with the marking store state_table lives in the table element_workflow_state. Reports on
workflow places need a Generic Data Index release that indexes it in the system field workflowPlaces, with one sub
field per workflow. The index queues an element for reindexing on workflow transitions and global actions, so it
follows the places.
Elements that were indexed before the field exists have no workflowPlaces and report no place. Reindex them once
after installing the release:
bin/console generic-data-index:update:index
A report on a workflow place answers with an error that names the missing index field while the index mapping does
not contain workflowPlaces.
Index Updates
Report Builder reports read the index, so a result is as current as the index. Changes of elements show up after the index queue has processed them. A field that is new in a class definition needs a reindex of the class, see the documentation of the Generic Data Index.
Configuration Options
Group Limit
A grouped report returns at most summary_group_limit groups (default 10000, never above group_limit). One search
creates at most group_limit groups. The default is the cluster setting search.max_buckets. group_limit also
sizes the searches of filters on related elements, lookups and parameter values; summary_group_limit only cuts the
groups of the result, so that a run answers in time. See Group Limit.
pimcore_statistics_explorer:
report_builder:
# default: search.max_buckets of the search cluster, minimum 100
group_limit: 10000
# default: 10000, minimum 100, never above group_limit
summary_group_limit: 10000
Large groupings can exhaust the heap of a search node before search.max_buckets stops them. On nodes with a small
heap, for example 1 GB, set a lower limit such as 10000. A report that exceeds the limit is cut and marked as
truncated, or paged as a full table. A report in which every group field has a top and whose groups, counted with
the distinct values of the data, still exceed the limit is cut at the top of its deepest group field, and the
result says so.
Export Limit
The CSV export of a list report exports every matching row, up to export_max_rows and the index.max_result_window
of the report's index. A report with more rows is not exported; the export stops with a message.
pimcore_statistics_explorer:
report_builder:
# default: 10000, fits workers with a memory_limit of 256M
export_max_rows: 10000
The export holds all rows in the memory of one messenger worker. See List Depth and CSV Export for the memory per row and how to choose the value.
Lookup Depth
A report can follow relations from the dataset to a field of a related object, for example
manufacturer.country.name. The setting max_lookup_depth sets the maximum number of relations, from 0 to 2:
pimcore_statistics_explorer:
report_builder:
max_lookup_depth: 2
A depth of 0 disables lookups. Two relations are the maximum.
Field Visibility
The field catalog follows the class definitions, asset metadata and the index mapping. The block_list of the
custom report integration
applies to the Statistics Mode and List Mode adapters only: it matches database columns and index names, not the field
paths of the Report Builder. The Report Builder has its own block list under report_builder. It is empty by default:
pimcore_statistics_explorer:
report_builder:
block_list:
# Class names (not class IDs): no dataset, and none of their fields wherever the class is reached
classes:
- Customer
# Regular expressions of field paths per dataset name: a class name, "asset", "document" or "event:<name>"
class_attributes:
Car:
- '/^internalCost$/'
asset:
- '/^metadata\.private/'
# Regular expressions of field paths for every dataset
global_attributes:
- '/password/i'
The expressions are PHP regular expressions with delimiters; an invalid one is rejected when the configuration is loaded. A pattern is
matched against the path of a field within the class or dataset that owns it. The field name of a manufacturer,
read from a car as manufacturer.name, is matched as name in the class Manufacturer: a pattern under
class_attributes.Manufacturer or in global_attributes hides it in every report that reaches the manufacturer, at
any lookup depth, and the full path (manufacturer.name) is matched in the dataset of the report as well. A
global_attributes pattern such as /^name$/ therefore hides name in the dataset and in every related class. Anchor
the expressions: /name/ hides every path that contains name.
A blocked class has no dataset, and every field of it is hidden wherever the class is reached, for example
manufacturer.name of a car. The relation field that points to it (manufacturer) stays, as its value is the id or
the label of the related element.
A relation field can allow several classes (or any class). The class of a related element is then not known, so the
fields behind such a relation (partner.key) are hidden as soon as classes is not empty, and the patterns under
class_attributes of every class apply to them. The relation field itself stays.
The block list applies to everybody, administrators included:
- Blocked fields are not offered by the field endpoint, the field picker or the MCP tools
describe_datasetandsearch_fields; a blocked class is not inlist_datasets. - A report configuration that uses a blocked field, in a column, group, value, filter, sort, parameter, drill-down or advanced filter, is refused by validate, preview and save, in Studio and in the MCP tools, with an error that names the field. A saved report that uses a field blocked later fails to run with the same error, no column is dropped silently. A report on a blocked class is refused, and so is a drill-down to a report on a blocked class. A drill-down on a relation field to the related elements stays possible: the relation field is not blocked.
Pimcore custom layouts do not limit the fields of a report: they arrange the edit form of an element and are no data permission. Use the block list to keep a field out of the Report Builder.
Custom Report Adapter
The Report Builder is a custom report adapter named reportBuilder. The bundle registers it when the Custom Reports
bundle is installed:
pimcore_custom_reports:
adapters:
reportBuilder: Pimcore\Bundle\StatisticsExplorerBundle\CustomReports\ReportBuilder\ReportBuilderAdapterFactory
A report of this adapter stores its configuration as the data source configuration of the custom report, see Report Configuration Schema. The generic parts of custom reports stay unchanged: sharing, the report tree, permissions, tabs and the CSV export of the report toolbar.
The adapter returns the result as a flat table for the generic grid and the export:
- The table uses the default values of the parameters. Column filters are not supported, because the viewer filters with parameters.
- A list report returns pages as deep as the
index.max_result_windowof its index allows. The export without a limit returns every row, or stops with a message when the report matches more rows thanexport_max_rowsor the window. - A summary report returns the groups the viewer shows, within the summary group limit.
- Sorting works for all columns of a summary report, and for the columns of a list report that are fields of the dataset itself.
A background export runs in a messenger worker with the permissions of the user that started the export.
Reportable Data
| Dataset | Source of the fields |
|---|---|
| Data objects | One dataset per class, from the class definition (including bricks, classification store, localized fields; not field collections and blocks) |
| Assets | System fields, fileSize, mimetype, width, height, duration, tags, indexed metadata |
| Documents | System fields, title, description, controller, template, navigation properties, tags |
| Events | Registered event indices, see Event Datasets |
The field catalog follows the class definitions and the live index mapping. A field the search index cannot query,
for example a field of a class not yet reindexed, is left out of the catalog. Ad hoc asset metadata is not
indexed. Localized fields inside object bricks are offered only with a Generic Data Index that has the container
localized-fields fix, after the class index has been rebuilt. To hide single fields or whole classes from every user,
including administrators, configure the report_builder.block_list, see
Field Visibility; the block_list of the custom report
integration does not apply. Pimcore custom layouts do not limit the fields of a report.
Data types the Report Builder does not know, for example a data type of another bundle, are left out of the catalog
and logged once per request at debug level (data type "<type>" is not reportable). A developer can add them with a
field type handler, see Custom Data Types.
Quantity values are reported in one unit per field, the report unit: the unit all values are stored in, else the default unit. Filters convert values of other units when the units share a base unit with a factor in the quantity value unit settings. Reports that sum, average, group or sort by a field are refused while they contain values in another unit than the report unit. See Quantity Values.
Event Datasets
An event dataset exposes a tracker index of Statistics Explorer to reports with {"type": "events", "name": "<name>"}.
Bundles register them with a service that implements
Pimcore\Bundle\StatisticsExplorerBundle\ReportBuilder\Event\EventDatasetProviderInterface. Autoconfigured services are
tagged with pimcore.statistics_explorer.report_builder.event_dataset_provider.
Event datasets do not use workspaces: access to the report decides who sees the events, and the optional
permission of the registration, which every access to the dataset checks. Related elements that the events name by
id are shown with the workspace permissions of the viewer.
The Portal Engine
registers portal_engine_logins, portal_engine_downloads and portal_engine_asset_updates for its statistics
trackers. They need no setup besides the Portal Engine statistics itself and a Statistics Explorer with the Report
Builder; the
Portal Engine statistics documentation
describes the trackers. The tracker index must be in the search cluster of the Generic Data Index. An index without
events has no mapping yet, so only its registered time and id fields appear.
See Tracking Events for the registration.
Custom Data Types
A data object data type decides which report fields it gives. The Report Builder knows the data types of Pimcore;
other data types, for example those of another bundle, are left out until a field type handler describes them. A
handler is a service that implements
Pimcore\Bundle\StatisticsExplorerBundle\ReportBuilder\FieldCatalog\Type\FieldTypeHandlerInterface. Autoconfigured
services are tagged with pimcore.statistics_explorer.report_builder.field_type_handler; handlers with a higher tag
priority are asked first, and the first one that supports a definition decides, before the built-in data types.
createFields() returns the report fields of a definition. FieldDefinitionContext::createField() creates a field at
the path of the definition or at a sub-path below it, with a type (FieldType) that decides the operators, measures,
grouping and sorting. Queries are compiled from the live index mapping: a field works when its path below
standard_fields. holds a keyword, a text with a keyword sub-field, a number, a date or a boolean, as the Generic
Data Index adapter of the data type writes it. Return an empty list to leave a definition out.
use Pimcore\Bundle\StatisticsExplorerBundle\ReportBuilder\FieldCatalog\FieldType;
use Pimcore\Bundle\StatisticsExplorerBundle\ReportBuilder\FieldCatalog\Type\FieldDefinitionContext;
use Pimcore\Bundle\StatisticsExplorerBundle\ReportBuilder\FieldCatalog\Type\FieldTypeHandlerInterface;
use Pimcore\Model\DataObject\ClassDefinition\Data;
/** A dimensions data type indexed as {"width": <number>, "height": <number>, "label": <keyword>} */
final readonly class DimensionsFieldTypeHandler implements FieldTypeHandlerInterface
{
public function supports(Data $definition): bool
{
return $definition instanceof DimensionsData;
}
public function createFields(Data $definition, FieldDefinitionContext $context): array
{
if (!$context->allowsSubFields()) {
return [];
}
return [
$context->createField(FieldType::NUMBER, 'width', 'Width'),
$context->createField(FieldType::NUMBER, 'height', 'Height'),
$context->createField(FieldType::STRING, 'label', 'Label'),
];
}
}
allowsSubFields() is false for classification store keys and localized fields, which have their own index paths;
a data type with a single value returns $context->createField(FieldType::STRING) there. The Report Builder describes
numeric, quantity value and date ranges and consents with the same interface.
Events
The Report Builder endpoints of Pimcore Studio dispatch pre-response events that let listeners adjust an answer before it is sent. All events extend
Pimcore\Bundle\StudioBackendBundle\Event\AbstractPreResponseEvent and expose addAdditionalAttribute(),
getAdditionalAttribute(), hasAdditionalAttribute() and removeAdditionalAttribute().
The classes are in the namespace Pimcore\Bundle\StatisticsExplorerBundle\Events\ReportBuilder\PreResponse.
| Class | Event name |
|---|---|
DatasetEvent | pre_response.statistics_explorer.report_builder.dataset |
FieldEvent | pre_response.statistics_explorer.report_builder.field |
ValidationResultEvent | pre_response.statistics_explorer.report_builder.validation_result |
ReportResultEvent | pre_response.statistics_explorer.report_builder.report_result |
ReportRunEvent | pre_response.statistics_explorer.report_builder.report_run |
ReportViewEvent | pre_response.statistics_explorer.report_builder.report_view |
DrillDownTargetEvent | pre_response.statistics_explorer.report_builder.drill_down_target |
Every event has one getter for the answer object: getDataset(), getField(), getValidationResult(),
getReportResult(), getReportRun(), getReportView() and getDrillDownTarget().
DatasetEventfires once per dataset of the dataset list.FieldEventfires once per field of the field list.ValidationResultEventfires after the validation of a configuration.ReportResultEventfires for a preview.ReportRunEventfires for the run of a saved report, with the view and the result.ReportViewEventfires when the view of a report is read.DrillDownTargetEventfires when a click is resolved.
namespace App\EventListener;
use Pimcore\Bundle\StatisticsExplorerBundle\Events\ReportBuilder\PreResponse\FieldEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
#[AsEventListener(event: FieldEvent::EVENT_NAME)]
final class FieldListener
{
public function __invoke(FieldEvent $event): void
{
$event->addAdditionalAttribute('priority', $event->getField()->getGroup() === 'Base data' ? 1 : 2);
}
}
The events add attributes to the answers. They do not change which fields reports can use or who can see data.