How do you ignore PropertyNotFoundException when parsing DMN?

I’m working with DMN for the first time and I have created a table with multiple inputs. Not all rules care about all inputs so some cells are left blank in the Modeler. This is working fine. However, if one of the Process Variables is not present, the DMN Engine throws a DMN-01002 exception caused by javax.el.PropertyNotFoundException.

Can this be suppressed or ignored somehow? If the variable is not present, I would just like it to match on anything/ignore that column in the DMN. Or maybe even have the expression evaluate to a default value like 0 for integer.

Thanks.

You’re going to need all of the specified input columns because it will go through each rule not just the ones that ignore the input.

You could of course create a scrip for the input instead of an expression. That way you can test to see if the variable exists and set something alternative.

Thanks Niall. Ideally I would like to avoid adding script engine dependencies to my application. The column is a double and I tried using this and other variations of this unary expression: purchaseTotalAmount == null ? 0.0 : purchaseTotalAmount.

I am still getting the PropertyNotFoundException though. Is this not possible at all using an Expression?

EDIT: I just tried using Javascript:
if (purchaseTotalAmount === undefined) 0.0; else purchaseTotalAmount;
I am getting “purchaseTotalAmount” is not defined. I guess this makes sense because this variable doesn’t even exist or has no declaration for it. Sidebar: In Camunda Modeler, the dropdown value for script is “Javascript” but the engine doesn’t recognize it. It recognized “JavaScript” though.

So it seems like even via script, that variable has to exist or is my script doing something wrong?

Figured it out! Using Javascript, I did:

var purchaseTotalAmount = purchaseTotalAmount;
if (purchaseTotalAmount === undefined)
  0.0;
else
  purchaseTotalAmount;
1 Like