Nikhil,

   By your code snippet it is clear that you should not be declaring the pattern twice in your rule. You may want to fix that.
   Also, you need to check that your code is correctly setting the values of the adultFare and childFare attributes, because if they are not correctly set, you will end up with a value of zero for them, that will make the rule to always fire.

   If, after checking that, you still think it is a problem, please provide a self contained junit test case that shows your problem and I will investigate.

   []s
   Edson


2008/3/18, Nikhil_dev <k.nikhil@verchaska.com>:

Hi,
Below is the code where i fire the Rule,
What i meant by "when i supply values to the above Rule" is,
In my application i have provided a place where user can enter values for
"Adult Fare", "Child Fare".... etc
so i take the values from the and set it in a bean....(u can understand from
below code)
even if the user doesn't provide the values the Rule Still Executes....
While firing a Rule it (Drool) doesn't give any error for missing
Values......
i hope u r getting what i am trying to say......
Waiting for  a Reply.

<code>
    try {

                final Reader sourceDRL = new StringReader(drlFileFormat);
// drlFileFormat is the String that contains the Dynamic Rule

                final PackageBuilder builder = new PackageBuilder();

                //this wil parse and compile in one step
                builder.addPackageFromDrl(sourceDRL);

                // Check the builder for errors
                if ( builder.hasErrors()){
                    System.out.println( builder.getErrors().toString() );
                    throw new RuntimeException("Unable to compile drl");
                }

                //get the compiled package (which is serializable)
                final Package pkg = builder.getPackage();

                //add the package to a rulebase (deploy the rule package).
                final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
                ruleBase.addPackage( pkg );

                final StatefulSession ruleStateSession =
ruleBase.newStatefulSession();

                ruleStateSession.addEventListener( new DebugAgendaEventListener()
);
                ruleStateSession.addEventListener( new
DebugWorkingMemoryEventListener() );

                ApplyRuleBean objApplyRuleBean = new ApplyRuleBean();
                if(!_jtxtAdultfare.getText().isEmpty())
                    objApplyRuleBean.setAdultFare(_jtxtAdultfare.getText());
                if(!_jtxtChildfare.getText().isEmpty())
                    objApplyRuleBean.setChildFare(_jtxtChildfare.getText());
                if(!_jtxtnettpayable.getText().isEmpty())

objApplyRuleBean.setNettPayable(_jtxtnettpayable.getText());

                /*Return "ruleStateSession" as a return type of the
function... for MultipleRule....*/
                ruleStateSession.insert(objApplyRuleBean);

                ruleStateSession.fireAllRules();

                ruleStateSession.dispose();

                int iIndexEquale = alActions.indexOf("=");
                String sResultObject = (String)
alActions.get(iIndexEquale-1);

                 if(sResultObject.equalsIgnoreCase("Adult Fare")){
                     AppConstantsBean.getInstance().showErrorMessage("Result
Adult Fare ::::
"+objApplyRuleBean.getAdultFare(),AppConstantsBean.INFO_MESSAGE);
                     System.out.println("Result adult fare ::::
"+objApplyRuleBean.getAdultFare());
                 }
                if(sResultObject.equalsIgnoreCase("Child Fare")){
                    AppConstantsBean.getInstance().showErrorMessage("Result
Child Fare ::::
"+objApplyRuleBean.getChildFare(),AppConstantsBean.INFO_MESSAGE);
                    System.out.println("Result child fare ::::
"+objApplyRuleBean.getChildFare());
                }
                if(sResultObject.equalsIgnoreCase("Nett Payable")){
                    AppConstantsBean.getInstance().showErrorMessage("Result
Nett Payable ::::
"+objApplyRuleBean.getNettPayable(),AppConstantsBean.INFO_MESSAGE);
                    System.out.println("Result nett payable ::::
"+objApplyRuleBean.getNettPayable());
                }
} catch (Throwable t) {
        t.printStackTrace();
    }
</code>








    What do you mean by "when i supply values to the above Rule" ?
    If you provide a snippet of the code you are using to assert objects
into the working memory and/or the values of the objects you are asserting,
it may be easier to understand your problem.
    It also does not seem right to declare the ApplyRuleBean pattern twice
as you are doing.

    []s
    Edson



-----
Regards,
:working:Nikhil

--
View this message in context: http://www.nabble.com/Missing-Values-for-a-Dymanic-Rule......-tp16091335p16114443.html

Sent from the drools - user mailing list archive at Nabble.com.

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



--
  Edson Tirelli
  JBoss Drools Core Development
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com