Re: [rules-users] modify and update is not working in the rule file

2012-08-21 Thread Davide Sottara
*DISCLAIMER: PLEASE NOTICE THAT THIS IS NOT RECOMMENDED, AND IN ANY CASE
SHOULD BE DONE WITH ***EXTREME*** CARE.*

This said, you need to create a KnowledgeBase passing a
RuleBaseConfiguration. 
Take a look at RuleBaseConfiguration.getComponentFactory(), which returns a
ReteooComponentFactory.
This class controls the sub-factories used to build parts of the RETE
network. In particular, you will
need to hack the NodeFactory (guess what it does :))

So, in reverse order: 

- Create a KnowledgeBase using a custom configuration
/KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( rbc );/

- When you create the configuration, do not use the interface, but the
actual implementation
/RuleBaseConfiguration rbc = (RuleBaseConfiguration)
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();/

- Set a custom NodeFactory in the configuration
/rbc.getComponentFactory().setNodeFactoryProvider( myNodeFactory );/

- The nodefactory should extend the appropriate methods and returned
customized nodes.
For example, to hack the alpha nodes:
/org.drools.reteoo.builder.NodeFactory myNodeFactory = new
DefaultNodeFactory() {
  public AlphaNode buildAlphaNode(int id, AlphaNodeFieldConstraint
constraint, ObjectSource objectSource, BuildContext context) {
return new MyAlphaNode( /* args from super constructor here */ );
  }
};/

- Your custom nodes should add the desired behaviour. For example, the
custom AlphaNode
could override the "assertObject" method
( see :
https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/reteoo/AlphaNode.java
)

/
...
if ( isAllowed(...) ) {
  ...
} else {
  // not present in the original
  // here, a particular object failed to satisfy a given constraint
}
/





--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019334.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-21 Thread Wolfgang Laun
Add a fact User with field group, set appropriately, and extend the
conditions of your rules as required.

I don't think that using agenda groups would be a good approach.

-W


On 21/08/2012, Rana  wrote:
> I have a requirement which says that only few rules should be fired based
> on
> the user group. How am I suppose to do that.
>
> Only thing I think of is that I have to setFocus in the rules on either
> Agenda-group or Activation-group.
>
> please let me know.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019306.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-21 Thread Rana
I have a requirement which says that only few rules should be fired based on
the user group. How am I suppose to do that.

Only thing I think of is that I have to setFocus in the rules on either
Agenda-group or Activation-group.

please let me know.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019306.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-20 Thread FrankVhh
"When a rule is activated where the auto-focus value is true and the rule's
agenda group does not have focus yet, then it is given focus, allowing the
rule to potentially fire." (c) Drools 5.4 Documentation


Rana wrote
> 
> Ok it worked when I changed the rule file a little to add the negative
> rules.
> 
> Focus on the Agenda should be dynamic so I have tried writing if-else
> stmts to focus on for different drugs?
> it did not work
> 
> ksession.getAgenda().getAgendaGroup( "AndroGel" ).setFocus();
> 
> Basically for every unit test even though I have set the focus, it is
> still siring all the rules of the other rule files also. How can I fix
> this.
> 
> 
> Also I have new requirement saying that when a rule satisfies, they only
> few rules to get fired based on the user input (like a grouped rules), so
> I thought I will use activation-groups apart from agenda-groups. But how
> can I focus on activating those activation-groups from Drools Rule File.
> 
> Thanks.
> 




--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019298.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-20 Thread Rana
Hi David, you told me we can tweak the engine to know what are the failed
rules. Can you please let me know how to do that.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019287.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Rana
Ok it worked when I changed the rule file a little to add the negative rules.

But this should be dynamic so I am guessing I should write if-else stmts to
focus on for different drugs?

ksession.getAgenda().getAgendaGroup( "AndroGel" ).setFocus(); 


* Logging is also not working in the rule file.

Logger logger = Logger.getRootLogger();

ksession.setGlobal("log", logger);

Also I have new requirement saying that when a rule satisfies, they only few
rules to get fired based on the user input (like a grouped rules), so I
thought I will use activation-groups apart from agenda-groups. But how can I
focus on activating those activation-groups from Drools Rule File.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019263.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Rana
Yes I have that, but no luck. But again this should be dynamic so I am
guessing I should write if-else stmts to focus on?

ksession.getAgenda().getAgendaGroup( "AndroGel" ).setFocus(); 


* Logging is also not working in the rule file.
Logger logger = Logger.getRootLogger();

ksession.setGlobal("log", logger);

workingMemory = ksession;

workingMemory.insert(logger);
workingMemory.insert(drug);
workingMemory.insert(address);
workingMemory.insert(program);

( (StatefulKnowledgeSession) workingMemory).fireAllRules();


When it was working, I included a retract in my rule and flushed all the
facts from the memory and since then it is not working.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019262.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Wolfgang Laun
On 17/08/2012, Rana  wrote:
> Thanks for reply to all.
>
> I would like to learn how to do that, but I don't want to implement now,
> since I do not have time for that. But please do let me know about it.
>
>
> Again, @Laune has helped me fix issues about I am getting null into
> response, but I am back to that. Please find the rule file attached. Also
> in
> rules the logs that I have, is not logging. Nothing is working, Logging,
> Modify.
>

Did you set the agenda-group "AndroGel"? If not, see some previous
mail in this thread.



> Also I want to know once the rules of a Rule file is fired and all is done
> in the rule file. Will it end the process or not.

The next statement after fireAllRules() (see below!) is executed.

>
> http://drools.46999.n3.nabble.com/file/n4019259/Rule.txt Rule.txt
>
>
> and this is how I am inserting facts
>
>   Logger logger1 = Logger.getRootLogger();  //log4j object
> //ProgramRuleValidationLog progRuleValidationLog = new
> ProgramRuleValidationLog();
>   
>   ksession.setGlobal("log", logger1);
> //ksession.setGlobal("progRuleValidationLog", 
> progRuleValidationLog);
>   
>   workingMemory = ksession;
>   
>   workingMemory.insert(logger1);
> //workingMemory.insert(progRuleValidationLog);
>   workingMemory.insert(drug);
>   workingMemory.insert(address);
>   workingMemory.insert(program);
>
>   ( (StatefulKnowledgeSession) 
> workingMemory).fireAllRules();
>
> logger =
> KnowledgeRuntimeLoggerFactory.newFileLogger((KnowledgeRuntimeEventManager)
> workingMemory, "DroolsLog"); //this is also not logging any thing except
>
> 
> 


Why should it? It's all over after fireAllRules()

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


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Rana
Thanks for reply to all.

I would like to learn how to do that, but I don't want to implement now,
since I do not have time for that. But please do let me know about it.


Again, @Laune has helped me fix issues about I am getting null into
response, but I am back to that. Please find the rule file attached. Also in
rules the logs that I have, is not logging. Nothing is working, Logging,
Modify.

Also I want to know once the rules of a Rule file is fired and all is done
in the rule file. Will it end the process or not.

http://drools.46999.n3.nabble.com/file/n4019259/Rule.txt Rule.txt 


and this is how I am inserting facts

Logger logger1 = Logger.getRootLogger();  //log4j object
//  ProgramRuleValidationLog progRuleValidationLog = new
ProgramRuleValidationLog();

ksession.setGlobal("log", logger1);
//  ksession.setGlobal("progRuleValidationLog", 
progRuleValidationLog);

workingMemory = ksession;

workingMemory.insert(logger1);
//  workingMemory.insert(progRuleValidationLog);
workingMemory.insert(drug);
workingMemory.insert(address);
workingMemory.insert(program);

( (StatefulKnowledgeSession) workingMemory).fireAllRules();

logger =
KnowledgeRuntimeLoggerFactory.newFileLogger((KnowledgeRuntimeEventManager)
workingMemory, "DroolsLog"); //this is also not logging any thing except




Please let me know the problems.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019259.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Davide Sottara
I agree with Stephen, if you need an action (e.g. logging) when a constraint
is violated, you are actually defining rules to handle the "negative" cases.
Drools verifier will not help you here, since knowing whether a fact
satisfied a constraint or not is a runtime problem and depends on the
combination of data and rules, whereas verifier looks at rules alone.
 
Could you please provide more details about your specific requirement? Do
you just need to know when a condition fails? Or do you need a full
analysis? I think we already discussed it: if you have a pattern with a
number of conditions, the engine will stop evaluating a fact as soon as the
first violation is encountered. Like in java, "&&" evaluation is terminated
eagerly. (In this case, the "not" CE would help).

Also consider this remark: when a constraint such as "field == value" is not
satisfied, the engine *silently* stops propagating the fact along that
branch of the RETE. So, there is no way to be notified of the failure of a
constraint. 
The WorkingMemoryListener and the AgendaListener will report only events
with a coarser granularity, so they won't help you.

If you really really really ... really need it, you will have to tweak the
engine. I could show you a few possible ways to do that, but I'm a bit
reluctant...



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019256.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Wolfgang Laun
To determine why some rule does not match, only proposals 2) and 3)
will work in the general case anyway.

If you're required to determine and log why rules do not fire, you'll
have to do what needs to be done. If you have, for example, 5
conditions, failure can be due to each, any combination and all of
them, and this information isn't available for free, and even your
"Business" should have enough savvy to understand that.

Either they drop the requirement, or they give you a free hand to fulfil it.

-W


On 17/08/2012, Rana  wrote:
> That's what our Business doesn't want me to do to write negative rules. In
> this way there will be 2 rules to be written for 1 business rule.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019250.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Stephen Masters
It's worth thinking about it differently. A rule does not fail. It just defines 
the conditions under which it will activate.

If you wish to perform an action whether the condition is true or false, you 
have 2 options:

A positive and a negative condition:
when 
test(a == "b")
then
...
when 
test(a != "b")
then
…

A condition which is always true:
when
test()
then
if (a.equals("b")) {
...
} else {
...
}

To be honest whether you write 1 or 2 rules should not be a 'business' 
decision. Why does anybody think there should not be 2 rules?

It's probably worth considering what you're trying to achieve. Does logging of 
a fact value really need to be part of a rule?

For instance, if you're actually just looking for an audit trail, you can have 
a WorkingMemoryEventListener, which can listen for all of the fact insertions, 
updates and retractions. It can log them all as they happen. Combined with an 
AgendaEventListener, you can log what rules have activated and what the values 
of facts were at the time. Use an asynchronous logger and this will have very 
little impact on rules processing performance.

Alternatively if the business are writing rules, and only wish to write the 
positive match, then maybe you can create a DSL which generates the both the 
positive and negative rules behind the scenes.

A few ideas there for you to try...

Steve




On 17 Aug 2012, at 15:49, Rana  wrote:

> That's what our Business doesn't want me to do to write negative rules. In
> this way there will be 2 rules to be written for 1 business rule.
> 
> Thanks.
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019250.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


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


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Rana
That's what our Business doesn't want me to do to write negative rules. In
this way there will be 2 rules to be written for 1 business rule.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019250.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Wolfgang Laun
Hasn't this been answered only recently on this list?

1) For simple conditions, a rule negating the condition of your rule
will fire if the other one fails:

rule "a != b"
when
  test( a != "b" )
then
  //consequence
end

2) If you have rules extending each other, the first one not firing
contains the condition(s) that are not fulfilled.

3) An individual analysis of the attributes of a fact can be done,
collecting the conditions that are fulfilled. At the end of the
analysis, you either have the situation that all required attributes
are fulfilled (and you can execute the consequence) or not, and thus
you know what's missing.

-W


On 17/08/2012, Rana  wrote:
> ok, thank you so much for your help. It works. Thanks.
>
> But one tough question for you.
>
> How can I know what was the reason a rule condition failed. Lets say
>
> rule
>   when
>  test( a == "b" )
>   then
>  //consequence
> end
>
> I want to know what caused the condition a=="b" to fail was the value of a
> is "b" or anything else. and I need to log this to a log file.
>
> Somebody told me that Verifier does the trick, but we need to add some
> custom rules to get to the values. I tried to google lot on this. But I
> never got anything which do what I want to do.
>
> Please help me on this.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019245.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Rana
ok, thank you so much for your help. It works. Thanks.

But one tough question for you.

How can I know what was the reason a rule condition failed. Lets say

rule
  when
 test( a == "b" )
  then
 //consequence
end

I want to know what caused the condition a=="b" to fail was the value of a
is "b" or anything else. and I need to log this to a log file.

Somebody told me that Verifier does the trick, but we need to add some
custom rules to get to the values. I tried to google lot on this. But I
never got anything which do what I want to do.

Please help me on this.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019245.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Wolfgang Laun
You must not use this:
   eval( boolBrandName && boolProviderState && boolDrugStrength )
since changes in global variables are not visible to the Drools rule engine.

But you don't need this eval(...) line, since you have
   rule "Brand Name"
   rule "Provider State" extends "Brand Name"
   rule "Drug Strength" extends "Provider State"
   rule "Check" extends "Drug Strength"
and therefore "Check" will not fire unless "Drug Strength" fires;
"Drug Strength" will not fire unless "Provider State" fires;
"Provider State" will not fire unless "Brand Name" fires.

-W

On 17/08/2012, Rana  wrote:
> ok I have done this, please find the rule file
>
>
> http://drools.46999.n3.nabble.com/file/n4019241/Rule.txt Rule.txt
>
>
> But it is still not setting the values for Program Fact in the rule file. I
> am getting null as output. Do I need to return that object. If yes please
> let me know and how can I get that back from WorkingMemory that I am using.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019241.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Rana
I have done this. Please find the rule file attached.

http://drools.46999.n3.nabble.com/file/n4019243/Rule.txt Rule.txt 

But it is still not setting the values for Program Fact in the rule file. I
am getting null as output. Do I need to return that object. If yes please
let me know and how can I get that back from WorkingMemory that I am using. 

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019243.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Rana
ok I have done this, please find the rule file


http://drools.46999.n3.nabble.com/file/n4019241/Rule.txt Rule.txt 


But it is still not setting the values for Program Fact in the rule file. I
am getting null as output. Do I need to return that object. If yes please
let me know and how can I get that back from WorkingMemory that I am using.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019241.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Wolfgang Laun
Although you can write

rule r
when ...
then
boolean b = true; ... x 
end

there is no way you can access these variables from anywhere else but
the place marked with "x", i.e., inside the very same rule.

To see whether certain rules have fired in a certain interval, you'll
have to use some global data, either a DRL global or some other public
instance. At the beginning of the interval you'll have to clear the
variable, and at the end of the interval you'll have to iterate over
the accumulated collection.

For instance:

Java code:

Set ruleNameSet = new HashSet();
kSession.setGlobal( "ruleNameSet", ruleNameSet );
//...
// Loop inserting a fact and firing all rules
for(...){
 ruleNameSet.clear();
 kSession.insert( anotherFact );
 kSession.fireAllRules();
 for( String ruleName: ruleNameSet ){
   //... ruleName has fired
 }
}

DRL code:

global Set ruleNameSet;

rule xyz
when...then...
ruleNameSet.add( drools.getRule().getName() );
end

Alternatively, to avoid the global and the addition to all right hand
sides, you can set up a listener and modify the Set
ruleNameSet accordingly.

-W

On 17/08/2012, Rana  wrote:
> How to use boolean variables in the rule. I want to do this
>
> rule
>when
>   //condition
>then
>   set a boolean to true
> end
>
>
> Then check at the last rule if all the boolean in the rules are true, which
> tells me that all the rules have passed.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019240.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-17 Thread Rana
How to use boolean variables in the rule. I want to do this

rule
   when
  //condition
   then
  set a boolean to true
end


Then check at the last rule if all the boolean in the rules are true, which
tells me that all the rules have passed.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019240.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Wolfgang Laun
Do you mean this:

global ProgramRuleValidationLog progRuleValidationLog;

function boolean logging(String actualValue, String ruleValue) {
  progRuleValidationLog.setActualValue(actualValue);
   //...
}

with the message "progRuleValidationLog cannot be resolved"?

This is due to a restriction: globals are not "global" for, and
therefore not visible in, functions defined in DRL.

You might pass it in as an additional function parameter:
function boolean logging(String actualValue, String ruleValue,
ProgramRuleValidationLog progRuleValidationLog ) {
   //...
}

-W


On 16/08/2012, Rana  wrote:
> ok but why is it not able to find my function written and why is it not
> able
> to find my global variable with it's name given.
>
> Please help me fix this global variable thing. Rest I will look into it
> later.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019212.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Rana
ok but why is it not able to find my function written and why is it not able
to find my global variable with it's name given.

Please help me fix this global variable thing. Rest I will look into it
later.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019212.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Wolfgang Laun
On 16/08/2012, Rana  wrote:
> ok so what is the flow of  the failed condition of the rule.

There is no "flow" for a rule not firing because one or more of its
conditions aren't met. Only recently I've suggested on this list a way
of determining why a rule does not fire. It requires a detailed,
individual investigation of the attributes contributing to the match.
Merely detecting that rules do not fire for a fact (or fact set) is
easier.

> Also you did
> not
> answer the first question of the function. It is not able to find my
> function in the rule file.

?

-W
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019210.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Rana
ok so what is the flow of  the failed condition of the rule. Also you did not
answer the first question of the function. It is not able to find my
function in the rule file.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019210.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Wolfgang Laun
The cancellation of an activation and the ensuing call to
activationCancelled() is NOT sufficient as an indication of the rule
not matching your fact data.

Scenario 1:
   - fact(s) inserted
   - activation created from rule R1
   - fireAllRules
   - activation of rule R1 fired

Scenario 2:
   - fact(s) inserted
   - activation created from rule R1
   - fireAllRules
   - fact(s) inserted/created/updated (due to another rule firing before R1)
   - activation from rule R1 cancelled

Scenario 3:
   - fact(s) inserted
   - fireAllRules
   - nothing happens

-W


On 16/08/2012, Rana  wrote:
> I have written a function
>
>
> function boolean logging(String actualValue, String ruleValue) {
>progRuleValidationLog.setActualValue(actualValue); //this is a pojo 
> which
> will give me what are the failed rules.
>  progRuleValidationLog.setRuleValue(ruleValue);
>
>  return true;
> }
>
>
> rule "Brand Name"
>   no-loop true
>   activation-group "AndroGel"
> when
>   drug : Drug()
>   eval( logging(drug.getBrandName, "AndroGel") )
>   Drug( brandName == "AndroGel" )
> then
>   log.info("Brand Name is AndroGel");
> end
>
>
> These are my listeners.
>
> @Override
>   public void 
> activationCreated(ActivationCreatedEvent arg0) {
>   // TODO Auto-generated method stub
>   super.activationCreated(arg0);
>   String actualValue = 
> progRuleValidationLog.getActualValue();
>   String ruleValue = 
> progRuleValidationLog.getRuleValue();
>   
> progRuleService.saveOrUpdate(progRuleValidationLog);
>   log.info("Activation Created Event =
> "+arg0.getActivation().getRule().getName()+" because Rule passed.");
>   log.info("Reason for Rule passed is 
> that the condition matched because
> the Actual value = "+actualValue+" did match with the Rule Value =
> "+ruleValue);
>   }
>   
>   @Override
>   public void 
> activationCancelled(ActivationCancelledEvent arg0) {
>   // TODO Auto-generated method stub
>   super.activationCancelled(arg0);
>   String actualValue = 
> progRuleValidationLog.getActualValue();
>   String ruleValue = 
> progRuleValidationLog.getRuleValue();
>   
> progRuleService.saveOrUpdate(progRuleValidationLog);
>   log.info("Activation Cancelled Event =
> "+arg0.getActivation().getRule().getName()+" because Rule failed.");
>   log.info("Reason for Rule failed is 
> that the condition did not match
> because the Actual value = "+actualValue+" did not match with the Rule
> Value
> = "+ruleValue);
>   }
>
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019208.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Rana
I have written a function


function boolean logging(String actualValue, String ruleValue) {
 progRuleValidationLog.setActualValue(actualValue); //this is a pojo 
which
will give me what are the failed rules.
 progRuleValidationLog.setRuleValue(ruleValue);
 
 return true;
}


rule "Brand Name"
no-loop true
activation-group "AndroGel"
when
drug : Drug()
eval( logging(drug.getBrandName, "AndroGel") )
Drug( brandName == "AndroGel" )
then
log.info("Brand Name is AndroGel");
end


These are my listeners.

@Override
public void 
activationCreated(ActivationCreatedEvent arg0) {
// TODO Auto-generated method stub
super.activationCreated(arg0);
String actualValue = 
progRuleValidationLog.getActualValue();
String ruleValue = 
progRuleValidationLog.getRuleValue();

progRuleService.saveOrUpdate(progRuleValidationLog);
log.info("Activation Created Event =
"+arg0.getActivation().getRule().getName()+" because Rule passed.");
log.info("Reason for Rule passed is 
that the condition matched because
the Actual value = "+actualValue+" did match with the Rule Value =
"+ruleValue);
}

@Override
public void 
activationCancelled(ActivationCancelledEvent arg0) {
// TODO Auto-generated method stub
super.activationCancelled(arg0);
String actualValue = 
progRuleValidationLog.getActualValue();
String ruleValue = 
progRuleValidationLog.getRuleValue();

progRuleService.saveOrUpdate(progRuleValidationLog);
log.info("Activation Cancelled Event =
"+arg0.getActivation().getRule().getName()+" because Rule failed.");
log.info("Reason for Rule failed is 
that the condition did not match
because the Actual value = "+actualValue+" did not match with the Rule Value
= "+ruleValue);
}


Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019208.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Wolfgang Laun
On 16/08/2012, Rana  wrote:
> How can I fire one rule file if I have lot of rule files defined in my
> change
> set. Right now I have written an if-else condition and checking if the
> input
> is Androgel then fire Angrogel rule fire.

But a rule (as you have it) with
   Drug( brandName == "AndroGel" )
will take care of that automaticaliy. This can co-exist with lots of
similar rules for anything between "Aspic" to "Zodiac".

>
> But how can I do that in real time.
>
> Also I have a requirement which says it needs the reason why the rule
> failed.

This is quite difficult if your rules are non-trivial except when there is a
restricted way facts are inserted and rules are fired. And even then it
requires a circumspect approach.

> So I have done this, I am setting all the actual and real values
> and
> saving the data to database in my event listeners.

Not clear what you gain by this.

>
> But I get this "Cannot return a void result" at line 6.

A method called in an eval must return a boolean, or has to be called
in a context that compares the result so that the comparison returns a
boolean. A "void" method can't be called at all.

-W

>
> rule "Brand Name"
>   no-loop true
>   agenda-group "AndroGel"
> when
>   $drug : Drug()
> eval( progRuleValidationLog.setActualValue($drug.getBrandName()) )
>
> //line 6
> eval( progRuleValidationLog.setRuleValue("AndroGel") )
> Drug( brandName == "AndroGel" )
> then
>   #drools.getWorkingMemory().setGlobal("boolBrandName", true);
>   log.info("Brand Name is AndroGel");
> end
>
>
> Thanks.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Rana
How can I fire one rule file if I have lot of rule files defined in my change
set. Right now I have written an if-else condition and checking if the input
is Androgel then fire Angrogel rule fire.

But how can I do that in real time.

Also I have a requirement which says it needs the reason why the rule
failed. So I have done this, I am setting all the actual and real values and
saving the data to database in my event listeners.

But I get this "Cannot return a void result" at line 6.


rule "Brand Name"
no-loop true
agenda-group "AndroGel"
when
$drug : Drug()
eval( progRuleValidationLog.setActualValue($drug.getBrandName()) )  
//line 6
eval( progRuleValidationLog.setRuleValue("AndroGel") )
Drug( brandName == "AndroGel" )
then
#drools.getWorkingMemory().setGlobal("boolBrandName", true);
log.info("Brand Name is AndroGel");
end


Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019202.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Wolfgang Laun
Something like
  kSession.getAgenda().getAgendaGroup( "AndroGel" ).setFocus();

With the way the rules are written an agenda-group doesn't appear to
be required at all, but who knows.

-W



On 16/08/2012, Esteban Aliverti  wrote:
> One last thing. Just like Wolfgang said: if you don't activate the
> agenda-group where the rule is defined its activations are never going to
> be executed.
>
> Best Regards,
>
> 
>
> Esteban Aliverti
> - Blog @ http://ilesteban.wordpress.com
>
>
> On Thu, Aug 16, 2012 at 4:29 PM, Esteban Aliverti <
> esteban.alive...@gmail.com> wrote:
>
>> By the way, what are you trying to do in this piece of code?
>>
>> Collection objs = workingMemory.getObjects();
>> Iterator it = objs.iterator();
>>
>> while (it.hasNext()) {
>> Object obj = it.next();
>> if (obj instanceof Program) {
>> FactHandle fact = workingMemory.getFactHandle(obj);
>> workingMemory.update(fact, obj);
>> }
>> }
>>
>> Best Regards,
>>
>> 
>>
>> Esteban Aliverti
>> - Blog @ http://ilesteban.wordpress.com
>>
>>
>> On Thu, Aug 16, 2012 at 4:25 PM, Esteban Aliverti <
>> esteban.alive...@gmail.com> wrote:
>>
>>> The project doesn't compile since the parent pom is missing. You don't
>>> event have the Drug and Program classes in it!
>>>
>>> Best Regards,
>>>
>>> 
>>>
>>> Esteban Aliverti
>>> - Blog @ http://ilesteban.wordpress.com
>>>
>>>
>>>
>>> On Thu, Aug 16, 2012 at 4:02 PM, Rana  wrote:
>>>
 Please find the project attached. Please check and help me out. I am
 now
 like
 cat on that wall. The project team needs it and this is giving me hard
 time.
 Please help



 http://drools.46999.n3.nabble.com/file/n4019196/pi-affiliate-drools-rule-engine.zip
 pi-affiliate-drools-rule-engine.zip


 Please help.

 Thanks.



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019196.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

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


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Esteban Aliverti
One last thing. Just like Wolfgang said: if you don't activate the
agenda-group where the rule is defined its activations are never going to
be executed.

Best Regards,



Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com


On Thu, Aug 16, 2012 at 4:29 PM, Esteban Aliverti <
esteban.alive...@gmail.com> wrote:

> By the way, what are you trying to do in this piece of code?
>
> Collection objs = workingMemory.getObjects();
> Iterator it = objs.iterator();
>
> while (it.hasNext()) {
> Object obj = it.next();
> if (obj instanceof Program) {
> FactHandle fact = workingMemory.getFactHandle(obj);
> workingMemory.update(fact, obj);
> }
> }
>
> Best Regards,
>
> 
>
> Esteban Aliverti
> - Blog @ http://ilesteban.wordpress.com
>
>
> On Thu, Aug 16, 2012 at 4:25 PM, Esteban Aliverti <
> esteban.alive...@gmail.com> wrote:
>
>> The project doesn't compile since the parent pom is missing. You don't
>> event have the Drug and Program classes in it!
>>
>> Best Regards,
>>
>> 
>>
>> Esteban Aliverti
>> - Blog @ http://ilesteban.wordpress.com
>>
>>
>>
>> On Thu, Aug 16, 2012 at 4:02 PM, Rana  wrote:
>>
>>> Please find the project attached. Please check and help me out. I am now
>>> like
>>> cat on that wall. The project team needs it and this is giving me hard
>>> time.
>>> Please help
>>>
>>>
>>>
>>> http://drools.46999.n3.nabble.com/file/n4019196/pi-affiliate-drools-rule-engine.zip
>>> pi-affiliate-drools-rule-engine.zip
>>>
>>>
>>> Please help.
>>>
>>> Thanks.
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019196.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Esteban Aliverti
By the way, what are you trying to do in this piece of code?

Collection objs = workingMemory.getObjects();
Iterator it = objs.iterator();

while (it.hasNext()) {
Object obj = it.next();
if (obj instanceof Program) {
FactHandle fact = workingMemory.getFactHandle(obj);
workingMemory.update(fact, obj);
}
}

Best Regards,



Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com


On Thu, Aug 16, 2012 at 4:25 PM, Esteban Aliverti <
esteban.alive...@gmail.com> wrote:

> The project doesn't compile since the parent pom is missing. You don't
> event have the Drug and Program classes in it!
>
> Best Regards,
>
> 
>
> Esteban Aliverti
> - Blog @ http://ilesteban.wordpress.com
>
>
>
> On Thu, Aug 16, 2012 at 4:02 PM, Rana  wrote:
>
>> Please find the project attached. Please check and help me out. I am now
>> like
>> cat on that wall. The project team needs it and this is giving me hard
>> time.
>> Please help
>>
>>
>>
>> http://drools.46999.n3.nabble.com/file/n4019196/pi-affiliate-drools-rule-engine.zip
>> pi-affiliate-drools-rule-engine.zip
>>
>>
>> Please help.
>>
>> Thanks.
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019196.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Esteban Aliverti
The project doesn't compile since the parent pom is missing. You don't
event have the Drug and Program classes in it!

Best Regards,



Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com


On Thu, Aug 16, 2012 at 4:02 PM, Rana  wrote:

> Please find the project attached. Please check and help me out. I am now
> like
> cat on that wall. The project team needs it and this is giving me hard
> time.
> Please help
>
>
>
> http://drools.46999.n3.nabble.com/file/n4019196/pi-affiliate-drools-rule-engine.zip
> pi-affiliate-drools-rule-engine.zip
>
>
> Please help.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019196.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Rana
Please find the project attached. Please check and help me out. I am now like
cat on that wall. The project team needs it and this is giving me hard time.
Please help


http://drools.46999.n3.nabble.com/file/n4019196/pi-affiliate-drools-rule-engine.zip
pi-affiliate-drools-rule-engine.zip 


Please help.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019196.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Wolfgang Laun
If you insert facts that have a chance to match, and if you
enable genda-group "AndroGel" then I see no reason why
it should not work.

-W


On 16/08/2012, Rana  wrote:
> Hi this is my rule file, can you help me modify to make it work please.
>
> http://drools.46999.n3.nabble.com/file/n4019187/Rule.txt Rule.txt
>
> Please let me know
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019187.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Rana
This is the log I get, it is not able to set the values at all. I even try to
update in the code. but still there is no data that I am setting in rule is
set at all.



0[main] INFO  com.drfirst.pi.affiliate.drools.DroolsKnowledgeObject  -
Drools Resource Scanner is set to 60 seconds
6[main] INFO  com.drfirst.pi.affiliate.drools.DroolsKnowledgeObject  -
Drools Resource Change Scanner Service has started
8[main] INFO  com.drfirst.pi.affiliate.drools.DroolsKnowledgeObject  -
Drools Resource Change Notifier Service has started
(null: 2, 171): cvc-elt.1: Cannot find the declaration of element
'change-set'.
1025 [main] INFO  com.drfirst.pi.affiliate.drools.DroolsKnowledgeObject  -
Knowledge Agent Created for all the Drools Files
1071 [main] INFO  com.drfirst.pi.affiliate.drools.DroolsKnowledgeObject  -
Knowledge Base is created and Session has started
Generic Name = AndroGel
1079 [main] INFO  com.drfirst.pi.affiliate.drools.FireRules  - Object
Inserted = org.apache.log4j.Logger@26a0e990
1088 [main] INFO  com.drfirst.pi.affiliate.drools.DroolsKnowledgeObject  -
Activation Created Event = Brand Name
1090 [main] INFO  com.drfirst.pi.affiliate.drools.DroolsKnowledgeObject  -
Activation Created Event = Provider State
1097 [main] INFO  com.drfirst.pi.affiliate.drools.FireRules  - Object
Inserted =
com.drfirst.pi.affiliate.json.Drug@63e708b2[ndcId=,brandName=AndroGel,genericName=AndroGel,form=,strength=20.25
mg/1.25 gram (1.62 %),strengthUnit=,additionalProperties={}]
1099 [main] INFO  com.drfirst.pi.affiliate.drools.FireRules  - Object
Inserted =
com.drfirst.pi.affiliate.json.Address@49d31859[address1=,address2=,city=,stateCode=MD,zipCode=,additionalProperties={}]
1100 [main] INFO  com.drfirst.pi.affiliate.drools.DroolsKnowledgeObject  -
Activation Created Event = Drug Strength
1100 [main] INFO  com.drfirst.pi.affiliate.drools.FireRules  - Object
Inserted =
com.drfirst.pi.affiliate.json.Program@41e3a0ec[programId=,programName=,programDescription=,programCategory=,additionalProperties={}]
1100 [main] INFO  com.drfirst.pi.affiliate.drools.FireRules  - Rules are
Fired
1102 [main] INFO  com.drfirst.pi.affiliate.drools.FireRules  - Object Update
=
com.drfirst.pi.affiliate.json.Program@41e3a0ec[programId=,programName=,programDescription=,programCategory=,additionalProperties={}]
1108 [main] INFO  com.drfirst.pi.affiliate.drools.FireRules  -
org.drools.audit.KnowledgeRuntimeLoggerProviderImpl$KnowledgeRuntimeFileLoggerWrapper@3de6696c
Program ID = null
Program Name = null


Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019191.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Rana
Hi this is my rule file, can you help me modify to make it work please.

http://drools.46999.n3.nabble.com/file/n4019187/Rule.txt Rule.txt 

Please let me know

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019187.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] modify and update is not working in the rule file

2012-08-16 Thread Wolfgang Laun
See inline:

On 15/08/2012, Rana  wrote:
> Please let me know what is the problem in this. It does not update the
> values
> when I get the values, it gives me null in my unit test method.

Any stack trace?

>
>
> rule "Drug Strength" extends "Provider State"
>   no-loop true
>   dialect "mvel"
>   agenda-group "AndroGel"
>   when
>   Drug( $drug.getStrength == "20.25 mg/1.25 gram (1.62 %)" )

Do you have a field "$drug" in class Drug? Otherwise $drug isn't
defined, and this
rule should not compile at all.

>   $p : Program()
>   then
>   #drools.getWorkingMemory().setGlobal("boolDrugStrength", true )
>   modify( $p) {
>   setProgramId( "610.conten...@samplemd.com" ),
>   setProgramName( "AndroGel 1.62% Savings Card" )
>   };
>   update( $p )

This is redundant because modify() does an update anyway.
-W

>   #retract( $p )
>   #retract( $drug )
>   log.info("Prgram ID and Program Name is set for program Coupon 
> for
> Androgel");
>   #drools.halt();
> end
>
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users