PHPJasper / phpjasper

A PHP report generator
MIT License
466 stars 162 forks source link

Problem pass params #267

Open hunterbit opened 4 years ago

hunterbit commented 4 years ago

I am trying to pass parameters but I always get error when I run the execute () command

If I delete the parameters from the options I have no problem and the report is generated without problems.

Here is the code I wrote and also the error that is generated. How can this be solved?

`<?php require DIR . '/vendor/autoload.php'; use PHPJasper\PHPJasper;

$input = DIR . '/report/test.jasper'; $output = DIR . '/report/test';

$options = [ 'format' => ['pdf'], 'params' => [ 'CODICE_CLIENTE' => '12121312' ] ];

$jasper = new PHPJasper(); //$jasper->compile($input)->execute();

$jasper->process( $input, $output, $options )->execute();`

This is error that I get when execute command. image

dinhunzvi commented 4 years ago

use the output() to execute the report in command prompt.

hunterbit commented 4 years ago

this is output

image

But in my report I have create CODICE_CLIENTE param

dinhunzvi commented 4 years ago

i am not sure if you are supposed to use the .jasper file instead of the .jrxml file as your input. can you share the list of parameters that you have in JasperSoft Studio

hunterbit commented 4 years ago

A very strange thing, I changed the name of the parameter and now it seems to work without any problems. I don't know what could have happened but now it's working. The only thing I changed is the filename and I didn't use the _ character