HI, I am new to Drools (and rule engine in general). I was trying to write a very simple rule but was stuck. I hope someone here can help me with my questions:
1. How do I write a condition such that it is a comparison between two (or more) columns of a fact? For example, rule "BuyWhenMarketPriceAndVolumeMatchesRule" when offer : StockOffer( price >= simpleMovingAverage ) then offer.setAction(StockOffer.Action.ACTION_BUY); end where price and simpleMovingAverage are both attributes of the StockOffer object. 2. How do I compare between a BigDecimal and a literal numeral? For example, rule "BuyWhenMarketPriceAndVolumeMatchesRule" when offer : StockOffer( price >= 90 ) then offer.setAction(StockOffer.Action.ACTION_BUY); end where price is a java.math.BigDecimal. 3. How do I "pass" variables into the working memory so that it can be used for rule conditions? For example: rule "BuyWhenMarketPriceAndVolumeMatchesRule" when offer : StockOffer( price >= $someVariableSetInWorkingMemory ) then offer.setAction(StockOffer.Action.ACTION_BUY); end where $someVariableSetInWorkingMemory is a variable passed into the working memory. Please let me know if some of my questions doesn't make sense in a rule engine... Thanks Charles -- http://del.icio.us/chancharles --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email