Hi,
I try using globals in functions but I get un error,
Exception in thread "main" org.drools.rule.InvalidRulePackage: Function
Compilation error
at org.drools.rule.Package.checkValidity(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
at
org.drools.examples.TroubleTicketExample.main(TroubleTicketExample.java:24)
Example:..
package org.drools.examples
import org.drools.examples.TroubleTicketExample.Customer;
import org.drools.examples.TroubleTicketExample.Ticket;
global java.util.Date mydate;
...
function java.util.Date fmydate() {
return mydate;
}
...
besides when I try to using in LHS, I get another error
Escalate:Unable to return Declaration for identifier 'mydate'
drools-examples/src/main/rules/org/drools/examples
TroubleTicket.drl line 51
package org.drools.examples
import org.drools.examples.TroubleTicketExample.Customer;
import org.drools.examples.TroubleTicketExample.Ticket;
global java.util.Date mydate;
rule "Escalate"
when
customer : Customer( object == mydate ) and
ticket : Ticket( customer == customer, status == "Escalate" )
then
sendEscalationEmail( customer, ticket );
end
So, I can use globlas only in RHS, ( then ...), this is true???
Greetings.
Show replies by date