Please follow Thomas' advice.
That now.time worked in 5.1.1 was actually an "accident", as it contradicted the specs. I'm not sure whether this behaviour is going to be reinstated.
If you do need to do the comparison on long (milliseconds since the epoch) values you'd have to do
subObject.dateField.time >= (now.getTime())
which works in 5.1.1, 5.2.0 and 5.3.0.so.far. (Being able to omit the parentheses was promised for 5.2.0; hopefully we'll have it in 5.3.0.)
-W
Hi Wolfgang,
Thank you for answering, here is the rule rewritten but closer to reality:
// package
// imports
rule "MyRule"
global java.util.Date now;
salience 5
when
// Prevent rule activation for other offer types.
MyObject(type == Type.TYPE_SOUGHT)
$candidate : Candidate(
subObject.dateField != null && subObject.dateField.time >=
now.time)
then
// do something
end
A value for 'now' being set like so:
session.setGlobal("now", new Date()); // Date being the java.util.Date.
But I do not think that matters because 'compilation' fails at this point.
Thank you in advance for your time.
--
View this message in context: http://drools.46999.n3.nabble.com/Issue-using-global-variable-with-Drools-5-2-in-DRL-tp3360343p3361770.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users