Hello,
well, You are right, but what if I want to use object's method in ACTION section like this:




CONDITION ACTION ACTIVATION-GROUP PRIORITY
  p:CProduct      
  name System.out.println(p.getName() + " " + "$param");    
Rules names
Product name what to print
   
Case A
A
Special A
G1 1
Case B
B Special B G1 1
General case

normal G1 0

In this case, I want for each CProduct fire it's method in ACTION column (like in rule "Case general" for DRL.
Thanks :)



2010/7/28 Mauricio Salatino <salaboy@gmail.com>
you can remove p, because in the spreadsheet you are not using it..
in the rules you use p to print the type of the product but in the spreadsheet you are hardcoding the value in the "what to print" column

2010/7/27 tom ska <tiberium.linux@gmail.com>
Hello,
I want to use StatelessSession with spreadsheet. I wrote few rules in DRL, but I cant do it in spreadsheet. First I want to present rules and class that is used by rules:

public class CProduct {

    private String name;
    private int value;

    public CProduct ()
    {
        name = "empty";
        value = 0;
    }
   
    public CProduct (String name, int value)
    {
        this.name = name;
        this.value = value;
    }
       
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getValue() {
        return value;
    }
    public void setValue(int value) {
        this.value = value;
    }   
}

Rules:

rule "Case A"
salience 1
activation-group "g1"
    when
        p : CProduct( name == "A" )
    then
        System.out.println("Special product: " + p.getName());
end

rule "Case B"
salience 1
activation-group "g1"
    when
        p : CProduct( name == "B" )
    then
        System.out.println("Special product: " + p.getName());
end

rule "Case general"
salience 0
activation-group "g1"
    when
        p : CProduct(  )
    then
        System.out.println("Normal product: " + p.getName());
end

Using stateLessSession, salience, and activation-group I can determine, that only one rule is going to be fired for each CProduct. And with salience param, I can determine priority (it is important to get special products first).
Now I am going to write those rules in spreadsheet. But I can't define rule "Case general".


  CONDITION ACTION ACTIVATION-GROUP PRIORITY
  p:CProduct      
  name System.out.println("$param");    
Rules names
Product name what to print
   
Case A
A
Special A
G1 1
Case B
B Special B G1 1
General case

normal G1 0

But when I am going to use the spreadsheet, I get this error:

"p cannot be resolved"

Problem disappears, when I fill "Product name" in "General case".

But I want it to be empty, because I want to fire rule "General case" when rules "Case A" & "Case B" won't fire for any object's name.

Thanks, Tom.



_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 - CTO @ http://www.plugtree.com 
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jbug.com.ar
 
 - Salatino "Salaboy" Mauricio -

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users