I have a rule which fires if some values are empty and fecthes those values
from database.
Here I will store the fetched values as Fact so as to prevent the same
values to be fetched again and again.
The other rule will fire if it finds macthing fact and so it will set values
from the Fact.

The second rule has higher salience.
The problem here is when a fact that matches second rule, it fires first and
fills the missing information.
But immediately after the first rule also fires even though the missing
values are now filled.
The test condition in the first rule is not evaluated again.

Please find the skeleton of rules below:
; Fetch details from the Security master
(defrule EnrichInstDetails_NoSecurityFact
    (declare (salience ?*CONTENT_SPECIFIC_RULE*))    
    ?trade <- (TradeCaptureReport (rptTyp ?*SUBMIT*)(RRNumLocation
?repLocation&~?*BARRACUDA*)
                        (instrmt ?security))
    (test (checkIfSecurityDetailsEmpty ?security))
    =>
    (log-info " Missing Security Details .. No Security facts.. Get from
Security master .. ")  
            (bind ?secArray (getSecurityFromDb ?security))
            .......    
    ;Assert the Fact for future use       
    (assert_SecurityDetails_Fact ?secArray)
)

; Fetch details from the Security Facts
(defrule EnrichInstDetailsFromFacts
    (declare (salience ?*CONTENT_SPECIFIC_RULE_2*))
    ?trade <- (TradeCaptureReport (rptTyp ?*SUBMIT*)
                                (instrmt ?security)(RRNumLocation 
?repLocation&~?*BARRACUDA*))
    ?sec <- (SecurityDetails (isin ?isin) (cusip ?cusip) (bbid
?bbid)(prodType ?prodTyp)
                        (name ?name)(coupon ?cpn)(matDate ?matDate)(ticker 
?ticker))
    (test (or (eq (get ?security ID) ?isin) (eq (get ?security ID) ?cusip)
(eq (get ?security ID) ?bbid)))
    (test (checkIfSecurityDetailsEmpty ?security))    
    =>    
    (log-info " Missing Security Details .. Filling from Security Facts ..
")    
    ;set all values
    
)

Any idea on why it is behaving this way ?
Please provide some other way to do this.
-- 
View this message in context: 
http://www.nabble.com/test-condition-evaluated-only-once-tp22574277p22574277.html
Sent from the Jess mailing list archive at Nabble.com.



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------

Reply via email to