I got the following rule to work:

(defrule validate-contactInfo-street "validate contactInfo's street"
?fact <- (contactInfo {street == "" && pob == "" || street != "" && pob != 
""})  
=>
(modify ?fact (streetError "street xor po box is required")))


But I can't get the "old style" version of this to work. I don't know why.

(defrule validate2-contactInfo-street "validate contactInfo's street"
?fact <- (or (and (contactInfo (street ""))  
                                    (contactInfo (pob "")))
                           (and (contactInfo (street ~"")) 
                                    (contactInfo (pob ~""))))  
=>
(modify ?fact (streetError "street xor po box is required")))

It says CE can't be bound to a variable. The ((( )))) look ok to me.

Reply via email to