Add Subtable to Custom Report

I want to add a subtable to a custom report. For this purpose I create a second DataTable in the API.php file in the function of the report, which I add to the report like this:


If I now call the API URL, the subtableId is displayed and if I add the SubtableId to the URL I get the related subtable.
But in the report inside Matomo I get a message that there is no data when I try to display the subtable.

What could be the reason for this? Do I have to specify the subtable in the GetLitfass.php file in the Reports folder? If yes how?

I have also tried to add it like this:


The function looks like this:

public function getLitfass($idSite, $period, $date, $segment = false, $idSubtable = false)
        if($idSubtable!=false) {
            return $this->getSubtable($idSite, $period, $date, $segment, $idSubtable);
           // ...

But I’m still being told there’s no data available.

Can anyone help me?

I changed $this->actionToLoadSubTables='getLitfass'; to $this->actionToLoadSubTables='getSubtable'; in my GetLitfass.php file and do now use $row->setNonLoadedSubtableId($subtableId); and it finally works :slight_smile:

1 Like