daysBetween : exception raised

I need to remove duplicate statistics so I compare two date fields. For some unknown reason "daysBetween" raises an exeption. d1 and d2 are created as local variables (objects also fail). Should I sanitse date fields before a call to daysBetween? daysBetween($d1,$d2) ^ at TIK.IVK_compress_new (CreateOrChangeVariable : 'Create Decimal variable') Advanced stacktrace: at com.mendix.languages.mxexpressions.MxExpression.evaluate(MxExpression.scala:15) Caused by: com.mendix.languages.expressions.ExpressionException: java.lang.NullPointerException at com.mendix.languages.expressions.Expr.evaluate( Caused by: java.lang.NullPointerException: null
1 answers

From your error message, it seems one of the dates your are using is empty. You don't need to sanitize, but you should check for empty values before comparing and somehow handle that situation.