Left or right hand side of binary expression cannot be empty

0
Product entity with attribute name called value (float/decimal) throws to evaluate expression. I made a separate check for not empty and in debug object is there. But ended up with below. Please share your suggestions. com.mendix.modules.microflowengine.MicroflowException: Failed to evaluate expression, error occurred on line 2, character 4 if $Product !=empty then if $Product/value > 0    ^ then true else false else false     at Module.MicroflowName (Change : 'Change 'NewProduct' (product_value)') Advanced stacktrace:     at com.mendix.languages.mxexpressions.MxExpression.evaluate(MxExpression.scala:16) Caused by: com.mendix.languages.expressions.ExpressionException: com.mendix.languages.expressions.ExpressionException: com.mendix.languages.expressions.ExpressionException: java.lang.IllegalArgumentException: Left and right hand side of binary expression should not be empty     at com.mendix.languages.expressions.Expr.evaluate(Expr.java:28) Caused by: com.mendix.languages.expressions.ExpressionException: com.mendix.languages.expressions.ExpressionException: java.lang.IllegalArgumentException: Left and right hand side of binary expression should not be empty     at com.mendix.languages.expressions.Expr.evaluate(Expr.java:28) Caused by: com.mendix.languages.expressions.ExpressionException: java.lang.IllegalArgumentException: Left and right hand side of binary expression should not be empty     at com.mendix.languages.expressions.Expr.evaluate(Expr.java:30) Caused by: java.lang.IllegalArgumentException: Left and right hand side of binary expression should not be empty     at com.mendix.languages.expressions.BinaryExpr.evaluateArithmeticOrComparisonExpression(BinaryExpr.java:164)     at com.mendix.languages.expressions.BinaryExpr.evaluateExpression(BinaryExpr.java:88)     at com.mendix.languages.expressions.Expr.evaluate(Expr.java:26)     at com.mendix.languages.expressions.IfExpr.evaluateExpression(IfExpr.java:28)     at com.mendix.languages.expressions.Expr.evaluate(Expr.java:26)     at com.mendix.languages.expressions.IfExpr.evaluateExpression(IfExpr.java:30)     at com.mendix.languages.expressions.Expr.evaluate(Expr.java:26)     at com.mendix.languages.mxexpressions.MxExpression.evaluate(MxExpression.scala:14)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeItemsExecutor$class.com$mendix$modules$microflowengine$actions$mxobject$ChangeItemsExecutor$$processActionItem(ChangeItemsExecutor.scala:77)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeItemsExecutor$$anonfun$executeChanges$1.apply(ChangeItemsExecutor.scala:44)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeItemsExecutor$$anonfun$executeChanges$1.apply(ChangeItemsExecutor.scala:43)     at scala.collection.Iterator$class.foreach(Iterator.scala:743)     at scala.collection.AbstractIterator.foreach(Iterator.scala:1174)     at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)     at scala.collection.AbstractIterable.foreach(Iterable.scala:54)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeItemsExecutor$class.executeChanges(ChangeItemsExecutor.scala:42)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeAction.executeChanges(ChangeAction.scala:17)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeAction.execute(ChangeAction.scala:45)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)     at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)     at com.mendix.core.actionmanagement.CustomActionMonitorImpl$$anonfun$run$1.apply(CustomMonitoredAction.scala:14)     at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2$$anon$1.execute(ActionDispatching.scala:145)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2.apply(ActionDispatching.scala:147)     at scala.util.Try$.apply(Try.scala:191)     at com.mendix.core.session.Worker$$anonfun$receive$3.applyOrElse(ActionDispatching.scala:141)     at akka.actor.Actor$class.aroundReceive(Actor.scala:465)     at com.mendix.core.session.Worker.aroundReceive(ActionDispatching.scala:137)     at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)     at akka.actor.ActorCell.invoke(ActorCell.scala:487)     at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)     at akka.dispatch.Mailbox.run(Mailbox.scala:220)     at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)     at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)     at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)     at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)     at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)  
asked
3 answers
4

You should add a separate check for $product/value != empty, for example by adding an exclusive split before checking if the value is > 0.

 

Even if the object is not empty, the value of an attribute within the object could still be empty, causing the error message..

answered
0

I noticed that the case is different: $Product and $product/value. Is your variable $Product or all lower case?

More general:

You could leave the if out and combine the two conditions into one:

$Product !=empty and $Product/value > 0

This will result in true or false. If $Product is empty, the remainder of the expression will not be evaluated.

answered
0

Mugilan, can you share the microflow with us using the Modeler's microflow share button? So we can see if we can reproduce it.

I think I reproduced what you said in https://modelshare.mendix.com/models/fbb222cc-bc59-401d-b9b4-b3c41d387da5/forumquestion-88178.

My conclusion is same as Joost's, that this: error is thrown because $Product/value is empty.

See the proposed solution: https://modelshare.mendix.com/models/c935f057-1495-4a43-acde-ff92384b8d3d/forum-question-88178-possible-solution

 

answered