[rules-users] Calling queries or collect() from functions

Miguel Paraz mparaz at gmail.com
Wed Oct 31 10:15:13 EDT 2012


Hi,
I have a rule like:

rule "Rule1"
    when
        $fact: Fact1()
        $allFacts: ArrayList() from collect(Fact1())

    then
        insert(new Fact2($allFacts.size()));
end


I want to compute $allFacts inside a function since I will use it across
different rules.
This doesn't work because it is not valid Java syntax:

function int size() {
    ArrayList a = ArrayList() from collect(InQueuePredicate());
    return a.size();
}

Could I put this in a named query, and call it from a function?

Thanks!
Miguel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20121031/2fc92c2f/attachment.html 


More information about the rules-users mailing list