PHP variable passed to JasperReports server for reports

Is it possible to pass a variable from php to a report on a JasperReports server? For example, in my php application, I save the department_id file in a session variable. I would like to pass department_id to my reports running on the JasperReports server and display information suitable for that department. in iReport I have a request like: SELECT * FROM employees WHERE department_id = $P{dept_id_from_php}but I need to create a drop-down list to pass the dept_id parameter.

The end result is that I would like the user to log in to my PHP application to view the employee information related to the department to which the registered user belongs. I do not want to pass this through a request, because the user can simply change the identifier in the query line and access information from other departments. Ideally, I would like to pass this parameter only once, and then reuse it in all reports, such as a global variable.

Is it possible?

+3
source share
1 answer

() php SOAP- https://github.com/adlermedrado/PHP-JasperServer-Integration . !

//example
//construct report object
$report    =    array("_REPORT_PARAMETER"=>$php_variable);

//valid output PDF, JRPRINT, HTML, XLS, XML, CSV and RTF
$jasper->run('/path/_Standard_Report','PDF',$report,false);

, XLS, , , .

+2

Source: https://habr.com/ru/post/1742179/


All Articles