The following is the code for a simple button to view the report in my Servoy Solution
- Code: Select all
/**
* Perform the element default action.
*
* @param {JSEvent} event the event that triggered the action
*
* @properties={typeid:24,uuid:"ED06AA59-4A82-4898-B0C0-B17321453011"}
*/
function btnPrintRPT(event) {
// var params = new java.util.HashMap()
// params.put("operator_code", '"SAMJ"')
// var serverName = databaseManager.getServerNames();
var params = new Object();
params.operator_code = forms.ReportTest.user_code;
// params.parameter2 = 2;
plugins.jasperPluginRMI.runReport("acss", "report4.jrxml", null, "print", params);
}
Below is the SQL query for the report in iReport the operator_code parameter was set up accordingly as a Java String Parameter
- Code: Select all
SELECT
operators."operator_id" AS operators_operator_id,
operators."creation_date" AS operators_creation_date,
operators."name" AS operators_name,
operators."user_code" AS operators_user_code
FROM
"public"."operators" operators
WHERE
operators."user_code" = $P{operator_code}
I have tried changing various things to try and get it working such as defining the params variable as an object or a new java Hash Map all to no avail. Any help or obvious errors I have over looked would be greatly appreciated