<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>   this is just a dumb question for drools-languaje gurus... like Edson :)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>How ca I write a rule (CE in LHS) for accumulate atributes inside an object, but this objects are not facts,</DIV><DIV>they are inside a collection which is an attribute from a fact... pretty messy right?...lol..</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>well, the business problem is this.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I need to count (accumulate) vacation days used on previous vacation requests.</DIV><DIV>I have an User (which is one fact) having a collection of oldVacationRequests</DIV><DIV>and an actual VacationRequest (the another fact).</DIV><DIV>So the rules is like this: discount to the available days for vacation those used in previous</DIV><DIV>vacation request, and those days are the days between initDate and endDate in each</DIV><DIV>old vacation request with isAproved seted true and having endDate before the actual</DIV><DIV>vacation request initDate.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>did I explain myself?... </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>so I need to know if this is possible I was trying to do something like this...but is obviously wrong...:)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#960000" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">rule</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#008000" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">"remove used vacation days"</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" color="#960000" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">no-loop</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" color="#960000" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">when</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">vr: VacationRequestVO($days: availableDays , $iniDate: initDate )</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">$u: UserVO( $vacReqList: vacationRequestList )</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">$usedDays: Number (intValue &gt; 1) from accumulate ( $ovr: VacationRequestVO( isAproved == true, endDate &lt; $iniDate, $uDays: usedDays),</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><SPAN class="Apple-tab-span" style="white-space:pre">                                                                                                                </SPAN>from $vacReqList, count($uDays))</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" color="#960000" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">then</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">vr.setAvailableDays($days - $usedDays);</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#960000" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">end</SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks... <BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV><SPAN class="Apple-style-span" style="text-decoration: underline;; -khtml-text-decorations-in-effect: underline; "><SPAN class="Apple-style-span" style="-khtml-text-decorations-in-effect: underline; ">                                                                        </SPAN></SPAN><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;"><B style="font-size: 13px; font-weight: bold; "><SPAN class="Apple-style-span" style="font-size: 13px; font-weight: bold; ">Felipe Piccolini M.</SPAN></B></SPAN></FONT></DIV><DIV><A href="mailto:felipe.piccolini@bluesoft.cl"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 238); -khtml-text-decorations-in-effect: underline; ">felipe.piccolini@bluesoft.cl</SPAN></A></DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></DIV></BODY></HTML>