Re: [rules-users] rules un end looping when update
If you already have it in your working memory then just add an additional condition in your rule with no constraints: rule "Your First Rule" when m: Workflow(workflowActorId==null,myid:workflowActorId) email : WorkflowMail() then System.out.println(myid + "its null values"); m.setWorkflowId(0); email.doSomething(); update(m); update(email); // if you have conditions on email and want rule re-evaluation to happen end Alternatively you could have WorkflowMail as a global if you only have one instance of it, or add appropriate constraints if there are multiple instances - otherwise your rule will fire multiple times, once for each one of them. > -Original Message- > From: rules-users-boun...@lists.jboss.org [mailto:rules-users- > boun...@lists.jboss.org] On Behalf Of sony john > Sent: 17 August 2010 14:13 > To: Rules Users List > Subject: Re: [rules-users] rules un end looping when update > > Thanks Thomas, > I am able to update now. > One more question i would like to ask you. > I i need to insert one more object called WorkflowMail and call > WorkflowMail when the above rule condition is True how i can do it. > I can insert the object but how i can call that object in rules. > REgards > Sony John > > > On Tue, Aug 17, 2010 at 7:05 PM, Swindells, Thomas wrote: > > I prefer using modify rather than update but that is a minor issue. > > Your key problem is that your rule fires regardless whether it needs to or > not, you need to write your rule so it only fires when it is valid for the > action to be performed. > > In your current rule you seem to be doing a null check against > workflowActorId and then setting workflowId; you probably want to make these > consistent so you do a null check and then set that same property to an > appropriate value. > > > > Thomas > > > >> -Original Message- > >> From: rules-users-boun...@lists.jboss.org [mailto:rules-users- > >> boun...@lists.jboss.org] On Behalf Of sony john > >> Sent: 17 August 2010 11:47 > >> To: Rules Users List > >> Subject: Re: [rules-users] rules un end looping when update > >> > >> hi thomas, > >> Thanks for reply , > >> I want to set values in workflow Object. How i can do it. I try > >> without update(m) but pojo is not updated. How i can accomplish the > >> below > >> after calling rules i need to get workflowid that has been updated in > rules. > >> { > >> ksession.insert(workflow); > >> ksession.fireAllRules(); > >> System.out.println( workflow.getWorkflowId()); > >> } > >> > >> > >> rule "Your First Rule" > >> when > >> m: Workflow(workflowActorId==null,myid:workflowActorId) > >> then > >> System.out.println(myid + "its null values"); > >> m.setWorkflowId(0); > >> update(m); > >> > >> > >> end > >> > >> On Tue, Aug 17, 2010 at 6:30 PM, Swindells, Thomas > wrote: > >> > You are calling update(m), which means that you are telling drools that m > >> has changed, which means that any rule that has a condition based upon that > >> rule gets re-evaluated, which causes "Your First Rule" to be fired again, > >> which will then update m again... > >> > > >> > Thomas > >> > > >> >> -Original Message- > >> >> From: rules-users-boun...@lists.jboss.org [mailto:rules-users- > >> >> boun...@lists.jboss.org] On Behalf Of sony john > >> >> Sent: 17 August 2010 11:28 > >> >> To: rules-users@lists.jboss.org > >> >> Subject: [rules-users] rules un end looping when update > >> >> > >> >> Hi all, > >> >> Iam using rules 5.1 > >> >> iam getting un endded printout in my console. > >> >> What could be the issue. > >> >> Thanks in advance. > >> >> > >> >> #created on: Aug 16, 2010 > >> >> package com.test.supplier > >> >> > >> >> #list any import classes here. > >> >> > >> >> > >> >> > >> >> #declare any global variables here > >> >> import com.test.supplier.dao.Workflow; > >> >> > >> >> > >> >> > >> >> rule "Your First Rule" > >> >> when > >> >> m: Workflow(workflowActorId==null,my
Re: [rules-users] rules un end looping when update
Thanks Thomas, I am able to update now. One more question i would like to ask you. I i need to insert one more object called WorkflowMail and call WorkflowMail when the above rule condition is True how i can do it. I can insert the object but how i can call that object in rules. REgards Sony John On Tue, Aug 17, 2010 at 7:05 PM, Swindells, Thomas wrote: > I prefer using modify rather than update but that is a minor issue. > Your key problem is that your rule fires regardless whether it needs to or > not, you need to write your rule so it only fires when it is valid for the > action to be performed. > In your current rule you seem to be doing a null check against > workflowActorId and then setting workflowId; you probably want to make these > consistent so you do a null check and then set that same property to an > appropriate value. > > Thomas > >> -Original Message- >> From: rules-users-boun...@lists.jboss.org [mailto:rules-users- >> boun...@lists.jboss.org] On Behalf Of sony john >> Sent: 17 August 2010 11:47 >> To: Rules Users List >> Subject: Re: [rules-users] rules un end looping when update >> >> hi thomas, >> Thanks for reply , >> I want to set values in workflow Object. How i can do it. I try >> without update(m) but pojo is not updated. How i can accomplish the >> below >> after calling rules i need to get workflowid that has been updated in rules. >> { >> ksession.insert(workflow); >> ksession.fireAllRules(); >> System.out.println( workflow.getWorkflowId()); >> } >> >> >> rule "Your First Rule" >> when >> m: Workflow(workflowActorId==null,myid:workflowActorId) >> then >> System.out.println(myid + "its null values"); >> m.setWorkflowId(0); >> update(m); >> >> >> end >> >> On Tue, Aug 17, 2010 at 6:30 PM, Swindells, Thomas >> wrote: >> > You are calling update(m), which means that you are telling drools that m >> has changed, which means that any rule that has a condition based upon that >> rule gets re-evaluated, which causes "Your First Rule" to be fired again, >> which will then update m again... >> > >> > Thomas >> > >> >> -Original Message- >> >> From: rules-users-boun...@lists.jboss.org [mailto:rules-users- >> >> boun...@lists.jboss.org] On Behalf Of sony john >> >> Sent: 17 August 2010 11:28 >> >> To: rules-users@lists.jboss.org >> >> Subject: [rules-users] rules un end looping when update >> >> >> >> Hi all, >> >> Iam using rules 5.1 >> >> iam getting un endded printout in my console. >> >> What could be the issue. >> >> Thanks in advance. >> >> >> >> #created on: Aug 16, 2010 >> >> package com.test.supplier >> >> >> >> #list any import classes here. >> >> >> >> >> >> >> >> #declare any global variables here >> >> import com.test.supplier.dao.Workflow; >> >> >> >> >> >> >> >> rule "Your First Rule" >> >> when >> >> m: Workflow(workflowActorId==null,myid:workflowActorId) >> >> then >> >> System.out.println(myid + "its null values"); >> >> update(m); >> >> >> >> >> >> end >> >> ___ >> >> rules-users mailing list >> >> rules-users@lists.jboss.org >> >> https://lists.jboss.org/mailman/listinfo/rules-users >> > >> > >> > >> ** >> >> > This message is confidential and intended only for the addressee. If you >> have received this message in error, please immediately notify the >> postmas...@nds.com and delete it from your system as well as any copies. The >> content of e-mails as well as traffic data may be monitored by NDS for >> employment and security purposes. To protect the environment please do not >> print this e-mail unless necessary. >> > >> > NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 >> 4EX, United Kingdom. A company registered in England and Wales. Registered >> no. >> 3080780. VAT no. GB 603 8808 40-00 >> > >> ** >> *
Re: [rules-users] rules un end looping when update
I prefer using modify rather than update but that is a minor issue. Your key problem is that your rule fires regardless whether it needs to or not, you need to write your rule so it only fires when it is valid for the action to be performed. In your current rule you seem to be doing a null check against workflowActorId and then setting workflowId; you probably want to make these consistent so you do a null check and then set that same property to an appropriate value. Thomas > -Original Message- > From: rules-users-boun...@lists.jboss.org [mailto:rules-users- > boun...@lists.jboss.org] On Behalf Of sony john > Sent: 17 August 2010 11:47 > To: Rules Users List > Subject: Re: [rules-users] rules un end looping when update > > hi thomas, > Thanks for reply , > I want to set values in workflow Object. How i can do it. I try > without update(m) but pojo is not updated. How i can accomplish the > below > after calling rules i need to get workflowid that has been updated in rules. > { > ksession.insert(workflow); > ksession.fireAllRules(); > System.out.println( workflow.getWorkflowId()); > } > > > rule "Your First Rule" > when > m: Workflow(workflowActorId==null,myid:workflowActorId) > then > System.out.println(myid + "its null values"); > m.setWorkflowId(0); > update(m); > > > end > > On Tue, Aug 17, 2010 at 6:30 PM, Swindells, Thomas wrote: > > You are calling update(m), which means that you are telling drools that m > has changed, which means that any rule that has a condition based upon that > rule gets re-evaluated, which causes "Your First Rule" to be fired again, > which will then update m again... > > > > Thomas > > > >> -Original Message- > >> From: rules-users-boun...@lists.jboss.org [mailto:rules-users- > >> boun...@lists.jboss.org] On Behalf Of sony john > >> Sent: 17 August 2010 11:28 > >> To: rules-users@lists.jboss.org > >> Subject: [rules-users] rules un end looping when update > >> > >> Hi all, > >> Iam using rules 5.1 > >> iam getting un endded printout in my console. > >> What could be the issue. > >> Thanks in advance. > >> > >> #created on: Aug 16, 2010 > >> package com.test.supplier > >> > >> #list any import classes here. > >> > >> > >> > >> #declare any global variables here > >> import com.test.supplier.dao.Workflow; > >> > >> > >> > >> rule "Your First Rule" > >> when > >> m: Workflow(workflowActorId==null,myid:workflowActorId) > >> then > >> System.out.println(myid + "its null values"); > >> update(m); > >> > >> > >> end > >> ___ > >> rules-users mailing list > >> rules-users@lists.jboss.org > >> https://lists.jboss.org/mailman/listinfo/rules-users > > > > > > > ** > > > This message is confidential and intended only for the addressee. If you > have received this message in error, please immediately notify the > postmas...@nds.com and delete it from your system as well as any copies. The > content of e-mails as well as traffic data may be monitored by NDS for > employment and security purposes. To protect the environment please do not > print this e-mail unless necessary. > > > > NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 > 4EX, United Kingdom. A company registered in England and Wales. Registered no. > 3080780. VAT no. GB 603 8808 40-00 > > > ** > > > > > ___ > > 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 ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rules un end looping when update
Hi Thomas, thanks Its my mistake i am able to solve it . rule "Your First Rule" when m: Workflow(workflowActorId==null,myid:workflowActorId) then System.out.println(myid + "its null values"); m.setWorkflowActorId(0); update(m); end On Tue, Aug 17, 2010 at 6:47 PM, sony john wrote: > hi thomas, > Thanks for reply , > I want to set values in workflow Object. How i can do it. I try > without update(m) but pojo is not updated. How i can accomplish the > below > after calling rules i need to get workflowid that has been updated in rules. > { > ksession.insert(workflow); > ksession.fireAllRules(); > System.out.println( workflow.getWorkflowId()); > } > > > rule "Your First Rule" > when > m: Workflow(workflowActorId==null,myid:workflowActorId) > then > System.out.println(myid + "its null values"); > m.setWorkflowId(0); > update(m); > > > end > > On Tue, Aug 17, 2010 at 6:30 PM, Swindells, Thomas wrote: >> You are calling update(m), which means that you are telling drools that m >> has changed, which means that any rule that has a condition based upon that >> rule gets re-evaluated, which causes "Your First Rule" to be fired again, >> which will then update m again... >> >> Thomas >> >>> -Original Message- >>> From: rules-users-boun...@lists.jboss.org [mailto:rules-users- >>> boun...@lists.jboss.org] On Behalf Of sony john >>> Sent: 17 August 2010 11:28 >>> To: rules-users@lists.jboss.org >>> Subject: [rules-users] rules un end looping when update >>> >>> Hi all, >>> Iam using rules 5.1 >>> iam getting un endded printout in my console. >>> What could be the issue. >>> Thanks in advance. >>> >>> #created on: Aug 16, 2010 >>> package com.test.supplier >>> >>> #list any import classes here. >>> >>> >>> >>> #declare any global variables here >>> import com.test.supplier.dao.Workflow; >>> >>> >>> >>> rule "Your First Rule" >>> when >>> m: Workflow(workflowActorId==null,myid:workflowActorId) >>> then >>> System.out.println(myid + "its null values"); >>> update(m); >>> >>> >>> end >>> ___ >>> rules-users mailing list >>> rules-users@lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/rules-users >> >> >> ** >> This message is confidential and intended only for the addressee. If you >> have received this message in error, please immediately notify the >> postmas...@nds.com and delete it from your system as well as any copies. The >> content of e-mails as well as traffic data may be monitored by NDS for >> employment and security purposes. To protect the environment please do not >> print this e-mail unless necessary. >> >> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 >> 4EX, United Kingdom. A company registered in England and Wales. Registered >> no. 3080780. VAT no. GB 603 8808 40-00 >> ** >> >> ___ >> 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] rules un end looping when update
hi thomas, Thanks for reply , I want to set values in workflow Object. How i can do it. I try without update(m) but pojo is not updated. How i can accomplish the below after calling rules i need to get workflowid that has been updated in rules. { ksession.insert(workflow); ksession.fireAllRules(); System.out.println( workflow.getWorkflowId()); } rule "Your First Rule" when m: Workflow(workflowActorId==null,myid:workflowActorId) then System.out.println(myid + "its null values"); m.setWorkflowId(0); update(m); end On Tue, Aug 17, 2010 at 6:30 PM, Swindells, Thomas wrote: > You are calling update(m), which means that you are telling drools that m has > changed, which means that any rule that has a condition based upon that rule > gets re-evaluated, which causes "Your First Rule" to be fired again, which > will then update m again... > > Thomas > >> -Original Message- >> From: rules-users-boun...@lists.jboss.org [mailto:rules-users- >> boun...@lists.jboss.org] On Behalf Of sony john >> Sent: 17 August 2010 11:28 >> To: rules-users@lists.jboss.org >> Subject: [rules-users] rules un end looping when update >> >> Hi all, >> Iam using rules 5.1 >> iam getting un endded printout in my console. >> What could be the issue. >> Thanks in advance. >> >> #created on: Aug 16, 2010 >> package com.test.supplier >> >> #list any import classes here. >> >> >> >> #declare any global variables here >> import com.test.supplier.dao.Workflow; >> >> >> >> rule "Your First Rule" >> when >> m: Workflow(workflowActorId==null,myid:workflowActorId) >> then >> System.out.println(myid + "its null values"); >> update(m); >> >> >> end >> ___ >> rules-users mailing list >> rules-users@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-users > > > ** > This message is confidential and intended only for the addressee. If you have > received this message in error, please immediately notify the > postmas...@nds.com and delete it from your system as well as any copies. The > content of e-mails as well as traffic data may be monitored by NDS for > employment and security purposes. To protect the environment please do not > print this e-mail unless necessary. > > NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 > 4EX, United Kingdom. A company registered in England and Wales. Registered > no. 3080780. VAT no. GB 603 8808 40-00 > ** > > ___ > 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] rules un end looping when update
You are calling update(m), which means that you are telling drools that m has changed, which means that any rule that has a condition based upon that rule gets re-evaluated, which causes "Your First Rule" to be fired again, which will then update m again... Thomas > -Original Message- > From: rules-users-boun...@lists.jboss.org [mailto:rules-users- > boun...@lists.jboss.org] On Behalf Of sony john > Sent: 17 August 2010 11:28 > To: rules-users@lists.jboss.org > Subject: [rules-users] rules un end looping when update > > Hi all, > Iam using rules 5.1 > iam getting un endded printout in my console. > What could be the issue. > Thanks in advance. > > #created on: Aug 16, 2010 > package com.test.supplier > > #list any import classes here. > > > > #declare any global variables here > import com.test.supplier.dao.Workflow; > > > > rule "Your First Rule" > when > m: Workflow(workflowActorId==null,myid:workflowActorId) > then > System.out.println(myid + "its null values"); > update(m); > > > end > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] rules un end looping when update
Hi all, Iam using rules 5.1 iam getting un endded printout in my console. What could be the issue. Thanks in advance. #created on: Aug 16, 2010 package com.test.supplier #list any import classes here. #declare any global variables here import com.test.supplier.dao.Workflow; rule "Your First Rule" when m: Workflow(workflowActorId==null,myid:workflowActorId) then System.out.println(myid + "its null values"); update(m); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users