FeelEngine not handling null values for list functions

Hi there,

I am currently using FEEL built in list functions, specifically max and min. It works fine when all values exist i.e. are not null, but when a value is null it cannot execute.

Example:
max(null, 0.5, 0.5)
has error of:
ValNull is not allowed
ValList(List(ValNull, ValNumber(0.5), ValNumber(0.5))) is not comparable

I would expect the default behaviour to just ignore null values and compare any of the remaining values…

Hi @phoebe

List maintains a list of object references. Object references can either be a reference to a valid, extant object, or null to indicate that they don’t currently contain an object reference.

If you try to invoke methods/variables on that resulted null , then you run into exception.

Hope it helps !

Thanks
Anmol

I see your point and agree that it would be handy. But according to the DMN spec, I don’t think that this expectation is correct. The function min()/max() expects a non-empty list of comparable items. But null is not comparable.

(DMN 1.3 page 160)

Note that you could filter the list and remove all null values. For example, by using the expression:

myValues[item != null]

Does this help you?