[rules-users] [Resolved] Re: Convert Integer to int in rule file

Jeremy Ary jeremy.ary at gmail.com
Thu Jan 24 13:22:29 EST 2013


rule "actes par competence"

no-loop
	when
		$a : Acte();
		eval($a.getCompetence().equals("MEDECIN"))
		
	then
		insert($a);
end


This rule seems incorrect to me. In readable form, this rule says
"When there exists some Acte whose competennce equals "MEDECIN", then
insert that Acte". If an Acte has already been inserted for this rule
to find, why would you want to re-insert the same Acte? I think you
might misunderstand the basics of setting up a rules session.
Somewhere close to where you are using setGlobal(), are you using a
"ksession.insert(new Acte())" or something similar?


If you were to do this instead, then your rule would fire...although
again, I'm not sure why you want to reinsert something that's already
been inserted:


Acte acte = new Acte();

acte.setCompetence("MEDICIN");

FactHandle acteHandle = ksession.insert(acte);

ksession.setGlobal("test", "my string test");

ksession.fireAllRules();



On Thu, Jan 24, 2013 at 12:03 PM, Mister Nono <noel.maurice at univ-jfc.fr>wrote:

> See the solution at this post :
>
> http://drools.46999.n3.nabble.com/Compare-two-String-objects-tp4021730p4021791.html
> <
> http://drools.46999.n3.nabble.com/Compare-two-String-objects-tp4021730p4021791.html
> >
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Convert-Integer-to-int-in-rule-file-tp4021739p4021795.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130124/afd7af12/attachment.html 


More information about the rules-users mailing list