I'm trying to build a rule that matches shadow facts using a Java Bean
template. I want to build the following logic:
(facilitycode != 'K' and faciltiycode!= 'S' and (amt > 7500 or amt <
-7500 or rvu < -500 or rvu > 500) )
OR ( (quantity < -10 or quantity > 10) and costctr in 403 111 702 189 489)
and (servicecode contains 100 and quantity > 1)
This is part of an application that will let users define the rules, 1
condition at a time. The rules will be written to disk and read in at
the start of the application. I'm wrapping the OR's in a TEST because I
only want to get back one match per rule.
When I run with a quantity of 10, I get a Jess Exception "Undefined
function test". If I use quantity of 11 I get back one match.
All the data is loaded with a Java Bean. I've come up with the following
(import com.accuserverx.accucharge.batchprocess.*)
(deftemplate BatchWorkListErrors "Java Object"
(declare (from-class
com.accuserverx.accucharge.batchprocess.BatchWorkListErrors)))
(deftemplate BatchInboundTransactions "Java Object"
(declare (from-class
com.accuserverx.accucharge.batchprocess.BatchInboundTransactions)))
(defrule Jim_Rule "Jim Rule Comment"
(BatchInboundTransactions (inbound_id ?inId))
(BatchInboundTransactions (facilitycode ?facilitycode))
(BatchInboundTransactions (amount ?amount))
(BatchInboundTransactions (rvu ?rvu))
(BatchInboundTransactions (quantity ?quantity))
(BatchInboundTransactions (costctr ?costctr))
(BatchInboundTransactions (servicecode ?servicecode))
(and
(and
(and(test(neq ?facilitycode S))(test(neq ?facilitycode K)))
(test(or(< ?amount -7500)(> ?amount 7500)(< ?rvu -500)(> ?rvu 500)
)))
(test(or(or(< ?quantity -10)(> ?quantity 10)) (and(test(foreach ?item
(create$ 403 111 702 189 489 )
(if (= ?item ?costctr) then
(return TRUE)
)
)
)
)))
(and(and(test(str-index 100 ?servicecode))(test(> ?quantity 1))
))
)
=>
(add(new BatchWorkListErrors "New" ?inId 1))
)
begin:vcard
fn:Jim Yates
n:Yates;Jim
email;internet:[EMAIL PROTECTED]
tel;work:214-244-4285
tel;cell:214-244-4285
x-mozilla-html:TRUE
version:2.1
end:vcard