Re: [rules-users] accumulate function
Thanks for your reply Wendy, but I have a question, would that code get me the sum of all the SegmentsGroup8?, or will that give me the sum of each individual SegmentGroup8??, cause what I need is the sum of all the controltotal of all the segmentGroup8 asserted into the WM... thanks so much for your help... -- View this message in context: http://drools.46999.n3.nabble.com/accumulate-function-tp3353507p3355812.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] accumulate function
Thanks Wendy, both solutions look great, I will try them. Thanks for your help. -- View this message in context: http://drools.46999.n3.nabble.com/accumulate-function-tp3353507p3356209.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] accumulate function
Hi everyone, I have this scenario: I have assserted a few elements of the type SegmentGroup8 into the working memory, this SegmentGroup8 class have inside a list called private ListControlTotal cnt; What I need to achieve is to perform a sum of one of the fields called c6066 inside the ControlTotal for all the SegmentGroup8 asserted into the WM... I would like to use the accumulate functions but I really dont know how, any help would be appreciated, thanks in advance... the classes code is the following... public class SegmentGroup8 implements Serializable { private ListControlTotal cnt; private ListMonetaryAmount moa; public ListControlTotal getCnt() { return cnt; } public void setCnt(ListControlTotal cnt) { this.cnt = cnt; } .. } public class ControlTotal extends Segment implements Serializable { private String c6069; private String c6066; public String getC6069() { return c6069; } public void setC6069(String c6069) { this.c6069 = c6069; } public String getC6066() { return c6066; } public void setC6066(String c6066) { this.c6066 = c6066; } . } -- View this message in context: http://drools.46999.n3.nabble.com/accumulate-function-tp3353507p3353507.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] Guvnor 5.2 method call in rhs
Yes, Im using Guvnor 5.2 -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-2-method-call-in-rhs-tp3275866p3276170.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] Guvnor 5.2 method call in rhs
This version: guvnor-5.2.0.Final-tomcat-6.0.war -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-2-method-call-in-rhs-tp3275866p3276180.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] counting Facts
Thanks man it works perfectly... :) But I have another scenario where inside each SegmentGroup7 theres a SegmentGroup14 and inside this group I have to verify a value inside another class called GoodsItemDetails, as in my last post I can collect all the occurrences with this code : $cuscar : Cuscar(); $group7: SegmentGroup7() from $cuscar.segmentGroup7; $group8 : SegmentGroup8() from $group7.segmentGroup8; $group14 : SegmentGroup14() from $group8.segmentGroup14; GoodsItemDetails(c7064 == 9 from $group14.gid ); but again I want to count the number of facts, is there a way to do this?? thanks so much in advance for your suggestions :) -- View this message in context: http://drools.46999.n3.nabble.com/counting-Facts-tp3192513p3197756.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] counting Facts
Thanks for the info, I will try that... -- View this message in context: http://drools.46999.n3.nabble.com/counting-Facts-tp3192513p3198936.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] counting Facts
Hi everyone, I need to perform a count of facts, but my problem is that the facts are nested inside other facts My model would be something like this a class called Cuscar that is like the main class that contains the other facts inside the class Cuscar I have a list called segmentGroup7 (private ListSegmentGroup7 segmentGroup7), and inside each SegmentGroup7 I have another list (ListSegmentGroup8 segmentGroup8) with this rule Im able to get all the facts of the type segmentGroup8 $cuscar : Cuscar(); $group7: SegmentGroup7() from $cuscar.segmentGroup7; $group8 : SegmentGroup8() from $group7.segmentGroup8; but I would like to count the number of facts, any idea how?? thanks so much for your help :) -- View this message in context: http://drools.46999.n3.nabble.com/counting-Facts-tp3192513p3192513.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] Global variable in LHS
Hi everybody, I would like to analyze a global value in the LHS of my rule without using an eval, something like this: global String globalVariable; rule 'SI-002-NAD-6' salience 5000 when global (globalVariable in (X,Y) then logger.log([SI-002-NAD-6] Debe colocar la informaciĆ³n del propietario del medio de transporte.); end I cant use eval because it doesnt recognize the keyword in, for example this code would throw me an error in the validation global String globalVariable; rule 'SI-002-NAD-6' salience 5000 when eval (globalVariable in (X,Y) then logger.log([SI-002-NAD-6] Debe colocar la informaciĆ³n del propietario del medio de transporte.); end any suggestions? thanks so much for your help :) -- View this message in context: http://drools.46999.n3.nabble.com/Global-variable-in-LHS-tp3180063p3180063.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] Global variable in LHS
OK, thank you both for your suggestions :) -- View this message in context: http://drools.46999.n3.nabble.com/Global-variable-in-LHS-tp3180063p3180393.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] Drools firing wrong rules
Thanks Wolfgang Laun-2... Ive been working on the code and this Cuscar(bgm.size 0 , $v: bgm[0] , $v.c1001== null ); seems to work too, I just added the variable declaration, have no idea why... Thanks everyone for your help... -- View this message in context: http://drools.46999.n3.nabble.com/Drools-firing-wrong-rules-tp3160376p3162841.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] Drools firing wrong rules
Hi everyone, I have a couple of rules, I just want to show a message when one of the fields is null and heres my code: 21. | rule 'rule1' 22. | salience 9990 23. | when 24. | Cuscar(bgm.size 0 bgm[0].c1001== null ); 25. | then 26. | logger.log(Rule 1 activated); 27. | 28. | end 29. | 30. | rule 'rule2' 31. | salience 9970 32. | when 33. | Cuscar(bgm.size 0 bgm[0].c1004== null ); 34. | then 35. | logger.log(Rule 2 activated); 36. | 37. | end And here's the result: Scenario #1 http://drools.46999.n3.nabble.com/file/n3160376/debug2.jpg with this values when I call fire all rules I dont get any message (its ok because none of the elements is null) Scenario #2 http://drools.46999.n3.nabble.com/file/n3160376/debug1.jpg with this values when I call fire all rules both rules are fired so i get both messages Rule 1 activated and Rule 2 activated (Incorrect - it should only fire rule number 1 cause only the element c1001 is null) Scenario #3 http://drools.46999.n3.nabble.com/file/n3160376/debug3.jpg with this values when I call fire all rules I dont get any message (Incorrect - it should activate rule number 2) This is my model: http://drools.46999.n3.nabble.com/file/n3160376/rules-drools-model-1.0.0-SNAPSHOT-jar-with-dependencies.jar rules-drools-model-1.0.0-SNAPSHOT-jar-with-dependencies.jar Can anybody help me please?, I dont know what am I doing wrong, thank you very much :) -- View this message in context: http://drools.46999.n3.nabble.com/Drools-firing-wrong-rules-tp3160376p3160376.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] Drools firing wrong rules
Hi.. sorry I didnt include all the information... heres the class Im using http://drools.46999.n3.nabble.com/file/n3160827/ruleInvoker.java ruleInvoker.java I use the method invocarReglas... I dont modify any fact, the values I show there are set before I insert the fact into the session... Im using drools 5.2 thanks for your help -- View this message in context: http://drools.46999.n3.nabble.com/Drools-firing-wrong-rules-tp3160376p3160827.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] Guvnor 5.2.0-Final in Tomcat 6.0.32 fail to compile rules
Thanks so much for your help guys, I will try your solutions... -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-2-0-Final-in-Tomcat-6-0-32-fail-to-compile-rules-tp3139077p3145092.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] Guvnor 5.2.0-Final in Tomcat 6.0.32 fail to compile rules
Heres my model: http://drools.46999.n3.nabble.com/file/n3142257/rules-drools-model-1.0.0-SNAPSHOT-jar-with-dependencies.jar rules-drools-model-1.0.0-SNAPSHOT-jar-with-dependencies.jar the class used in the rules is this: package gt.gob.sat.aduana.carga.rules.edifact.cuscar; import java.io.*; import java.util.Iterator; import java.util.List; import gt.gob.sat.aduana.carga.rules.edifact.common.*; public class Cuscar implements Serializable { private static final long serialVersionUID = 1L; private List UNB; private List UNH; private List BGM; private List segmentGroup1; private List segmentGroup2; private List FTX; private List segmentGroup4; private List GIS; private List segmentGroup5; private List CNT; private List segmentGroup7; private List segmentGroup17; private List UNT; private List UNZ; public Cuscar() { } public List getBGM() { return BGM; } public void setBGM(List bGM) { BGM = bGM; } public List getSegmentGroup1() { return segmentGroup1; } public void setSegmentGroup1(List segmentGroup1) { this.segmentGroup1 = segmentGroup1; } public List getSegmentGroup2() { return segmentGroup2; } public void setSegmentGroup2(List segmentGroup2) { this.segmentGroup2 = segmentGroup2; } public List getFTX() { return FTX; } public void setFTX(List fTX) { FTX = fTX; } public List getSegmentGroup4() { return segmentGroup4; } public void setSegmentGroup4(List segmentGroup4) { this.segmentGroup4 = segmentGroup4; } public List getGIS() { return GIS; } public void setGIS(List gIS) { GIS = gIS; } public List getSegmentGroup5() { return segmentGroup5; } public void setSegmentGroup5(List segmentGroup5) { this.segmentGroup5 = segmentGroup5; } public List getCNT() { return CNT; } public void setCNT(List cNT) { CNT = cNT; } public List getSegmentGroup7() { return segmentGroup7; } public void setSegmentGroup7(List segmentGroup7) { this.segmentGroup7 = segmentGroup7; } public List getSegmentGroup17() { return segmentGroup17; } public void setSegmentGroup17(List segmentGroup17) { this.segmentGroup17 = segmentGroup17; } public List getUNH() { return UNH; } public void setUNH(List uNH) { UNH = uNH; } public List getUNT() { return UNT; } public void setUNT(List uNT) { UNT = uNT; } public List getUNZ() { return UNZ; } public void setUNZ(List uNZ) { UNZ = uNZ; } public List getUNB() { return UNB; } public void setUNB(List uNB) { UNB = uNB; } Thank you... -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-2-0-Final-in-Tomcat-6-0-32-fail-to-compile-rules-tp3139077p3142257.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] Guvnor 5.2.0-Final in Tomcat 6.0.32 fail to compile rules
Hi everyone, I am trying to create some rules with Guvnor guided editor but when I try to validate the rule it gives me a error message like this: Unable to wire compiled classes, probably related to compilation failures:[Error: unable to resolve method using strict-mode: java.lang.Object.dateTimePeriod()] [Near : {... DTM[0].dateTimePeriod.dateOrTimeOrPer }] ^ [Line: 1, Column: 8 I have tried to turn off the strict mode by modifying the drools.packagebuilder.conf putting false in this property, but nothing seems to work drools.dialect.mvel.strict = false Thanks so much for your help... :) -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-2-0-Final-in-Tomcat-6-0-32-fail-to-compile-rules-tp3139077p3139077.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