document template datagrid data causes java.lang.Long cannot be cast to java.lang.Double

0
We want to generate a document (output HTML) using a document template that contains a datagrid containing our entity invoices. Invoice entity contains several columns of data type Currency (e.g. total amount, amountexclvat etc...) and we want to display these columns in the datagrid. All seems to work fine as long as all currency columns contain positive amounts. Once 1 specific column (amountexclvat) contains a negative amount (e.g. -10,00 or -1233,22) we get the error displayed below. The strange thing is that any of other currency columns can contain negative amounts without causing any issues. I noticed that not displaying the amountexclvat data on the document does not make a difference, we still get the error. The error is caused in the Generate document node of the microflow. I tried to reproduce in a test project, but I cannot. Any assistance in resolving this issue is appreciated. Kind regards, Brian An error has occurred while handling the request. [User 'b.golsteijn' with roles 'MxAdministrator, AccountTeamLeader, ReportTEMP'] la: java.lang.Long cannot be cast to java.lang.Double at {} at ApplicationMaintenance.GenerateInvoiceAndRemindersEnrichEmail ( : 'Generate HTML (.html) document using template 'DTInvoiceReminder2'') at {} at ApplicationMaintenance.GenerateInvoiceAndReminderEmails (SubMicroflow : 'Call 'GenerateInvoiceAndRemindersEnrichEmail'') at ApplicationMaintenance.SCECONFIGGenerateReminderEmails (SubMicroflow : 'Call 'GenerateInvoiceAndReminderEmails'') Advanced stacktrace: at mg.a(SourceFile:188) Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Double at kH.a(SourceFile:103) at ku.a(SourceFile:140) at ku.a(SourceFile:124) at ku.a(SourceFile:90) at kw.a(SourceFile:321) at kF.a(SourceFile:70) at kw.a(SourceFile:321) at kw.a(SourceFile:129) at kq.a(SourceFile:81) at ko.a(SourceFile:89) at ko.a(SourceFile:56) at lg.a(SourceFile:109) at mg.a(SourceFile:73) at mf.executeAction(SourceFile:101) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:57) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:457) at hC.b(SourceFile:183) at com.mendix.core.Core.executeSync(SourceFile:196) at li.a(SourceFile:70) at mg.a(SourceFile:73) at mf.executeAction(SourceFile:101) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:57) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:457) at hC.b(SourceFile:183) at com.mendix.core.Core.executeSync(SourceFile:196) at li.a(SourceFile:70) at mg.a(SourceFile:73) at mf.executeAction(SourceFile:101) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:57) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:457) at hC.b(SourceFile:183) at com.mendix.core.Core.execute(SourceFile:219) at gm.execute(SourceFile:186) at iW.a(SourceFile:304) at com.mendix.externalinterface.connector.RequestDispatching$Worker.a(SourceFile:148) at com.mendix.externalinterface.connector.RequestDispatching$Worker$a.a(SourceFile:140) at com.mendix.externalinterface.connector.RequestDispatching$Worker$a.apply(SourceFile:138) at akka.actor.Actor$class.apply(Actor.scala:545) at com.mendix.externalinterface.connector.RequestDispatching$Worker.apply(SourceFile:134) at akka.actor.LocalActorRef.invoke(ActorRef.scala:910) at akka.dispatch.MessageInvocation.invoke(MessageHandling.scala:25) at akka.dispatch.ExecutableMailbox$class.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:223) at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:123) at akka.dispatch.ExecutableMailbox$class.run(ExecutorBasedEventDrivenDispatcher.scala:195) at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.run(ExecutorBasedEventDrivenDispatcher.scala:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) at akka.dispatch.MonitorableThread.run(ThreadPoolBuilder.scala:192)
asked
2 answers
1

do you use a if then else construction somewhere where it sais something like

if $var = empty empty
then 0
else $var div 100

The div wil always result in a float which makes the result a float, but the 0 is seen as a long/int and thus you can get a class cast exception. To avoid this it is best to output static nr's as 0.00 or 1.00 or 2.00 etc.

answered
0

I checked my calculated field (interest) and I did use an if statement however it returned 0 (static) in certain conditions. After I changed this to 0.00 it now works properly. Thanks for your answers! Issue resolved.

answered