using objects instead of hashmap to set properties

Hi,

for setting jasper reports we were using hashmaps, to send the parameters to the report, like this:

var $ParametersMap = new java.util.HashMap(); //object
$ParametersMap.put('invoiceid', invoicesid);

in the new version of our solution we switched to using objects like this:

var vParameters = new Object(); //object
vParameters.invoiceid = invoicesid

Now sometimes, we get this error in the debug or realclient:

Incompatible java.lang.Long value assigned to parameter invoiceid in the invoice1 dataset.
Wrapped java.lang.Exception: Incompatible java.lang.Long value assigned to parameter invoiceid in the invoice1 dataset. (D:\Servoy_Workspaces\servoy_workspace5\DirectManager\forms\invoices_print_menu.js#135)

the parameter: invoiceid in jasper is of type: java.lang.Integer. Should I change that to java.lang.Long?

The weird thing is that when we are using using hashmaps, this error never occurs.
Anyone knows, what is going on here?

you might try

var vParameters = new Object(); //object
vParameters.invoiceid = new java.lang.Integer(invoicesid)

In order to force the type to Integer
Although the jasper plugin might not be able to differentiate due to the javascript assignment.

oke i tried your suggestion, but now it says:

Incompatible java.util.HashMap value assigned to parameter invoiceid in the invoice1 dataset.
Wrapped java.lang.Exception: Incompatible java.util.HashMap value assigned to parameter invoiceid in the invoice1 dataset. (D:\Servoy_Workspaces\servoy_workspace5\DirectManager\forms\invoices_print_menu.js#136)

I did’nt switch back to hashmaps!! :shock:

the problem is with new created invoices (in this case invoiceid = 603)
when I restart de debug client and fire the same record to jasper report, no error and everything is fine!!