Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Carlos_rsd's avatar

Subreport in JasperStudio and Laravel

Good afternoon! I have a question about using subreports in jasperstudio using Laravel. I created a report and a subreport, both located in the same folder, and when running the code I receive an error message stating that the subreport was not found. I've already tried creating a parameter called SUBREPORT_DIR and passing the absolute path of the subreport and it still doesn't find it. Have you ever experienced something like this using JasperStudio 6.17, Laravel 5.7 and PHP 7.4. Below is the excerpt of the code that feeds the parameter: $subRelatorio = base_path('public/reports/relatorios/progressao/subreport.jasper');

     $parameters = [
         'p_anoLetivo' => $request->ano_letivo,
         'pccriterio' => $criterio,
         'username' => $user->name,
         'SUBREPORT_DIR' => $subReport
     ];

And the excerpt from Jasper's main report where the subreport is called: <reportElement x="360" y="22" width="390" height="50" uuid="bfa5ab8e-641c-4ddb-8345-7e607b792abf"/> <subreportParameter name="pidAlunoProgressao"> <subreportParameterExpression></subreportParameterExpression> </subreportParameter> <subreportParameter name="panoMatriculaProgressao"> <subreportParameterExpression></subreportParameterExpression> </subreportParameter> <connectionExpression></connectionExpression> <subreportExpression></subreportExpression>

Any help will be appreciated.

Thank you, Carlos Henrique

0 likes
3 replies
gych's avatar

Try to use this instead of base_path

$subRelatorio = public_path('reports/relatorios/progressao/subreport.jasper');
Carlos_rsd's avatar

Gych, I made the change and it worked. Thank you for your help.

Carlos Henrique

gych's avatar

@Carlos_rsd No problem, I'm glad it works now. Please don't forget to close your thread by selecting the best answer :)

Please or to participate in this conversation.