[rules-users] Issue using global 'variable' with Drools 5.2 in DRL

Slorg1 slorg1 at percipiomedia.com
Fri Sep 23 08:54:19 EDT 2011


Hi Wolfgang,

Thank you for answering, here is the rule rewritten but closer to reality:

// package

// imports

global java.util.Date now;

rule "MyRule"
   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.



More information about the rules-users mailing list