<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hi,&nbsp;I have two kind of facts in a map.<div><div>There is a field called _TYPE_ (H)eader, D)etail)</div><div>In the Header line I have two String fields, one for the number of details lines ("NU_REGISTROS") and another for the sum of the detail line ("MT_TOTAL")</div><div>In the detail lines I only have a String field called "MONTO"&nbsp;</div><div><br></div><div>I would like to build two rules. One to check the count of detail lines versus the field in the header line so I wrote :</div><div><br></div><div>rule "Contador de lineas detalle vs Header"</div><div>&nbsp;&nbsp;salience 10</div><div>&nbsp;&nbsp;when</div><div>&nbsp;&nbsp; &nbsp; &nbsp; $numRecs : Number()</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;from accumulate(Map(this["_TYPE_"] == "D", $d : this["_NUMLINE_"]), count($d))</div><div>&nbsp;&nbsp; &nbsp; &nbsp; $map : Map(this["_TYPE_"] == "H",</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this["NU_REGISTROS"] != $numRecs)</div><div>&nbsp;&nbsp;then</div><div>&nbsp;&nbsp; &nbsp;System.out.println("NumRecs=" + $numRecs);</div><div>&nbsp;&nbsp; &nbsp;listBitacora.add(new BitacoraDTO($map.get("_NUMLINE_"),</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Error en el Detalle: El número del lineas de detalle (" + &nbsp;$total +</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;") no empareja con lo del encabezado (" + $map.get("NU_REGISTROS") + ")"));</div><div>&nbsp;end</div><div>&nbsp;</div><div>&nbsp;However I always got "NumRecs=1" when i print out the value of $numRecs but I am absolute sure there is two details lines...</div><div>&nbsp;</div><div>&nbsp;Second when i try to sumarize the total field in the details line i got (MONTO in the detail line is a string):</div><div>&nbsp;</div><div>&nbsp;rule "Sumatoria de lineas detalle vs Header"</div><div>&nbsp;&nbsp;salience 10</div><div>&nbsp;&nbsp;when</div><div>&nbsp;&nbsp; &nbsp; &nbsp; $total : Number()</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;from accumulate(Map(this["_TYPE_"] == "D",</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$monto : this["MONTO"]),</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sum(eval(Double.valueOf((String) $monto ))))</div><div>&nbsp;&nbsp; &nbsp; &nbsp; $map : Map(this["_TYPE_"] == "H",</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this["MT_TOTAL"] != $total)</div><div>&nbsp;&nbsp;then</div><div>&nbsp;&nbsp; &nbsp;System.out.println("TOTAL=" + $total);</div><div>&nbsp;&nbsp; &nbsp;listBitacora.add(new BitacoraDTO($map.get("_NUMLINE_"),</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Error en el Detalle: El número del lineas de detalle (" + &nbsp;$total +</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;") no empareja con lo del encabezado (" + $map.get("NU_REGISTROS") + ")"));</div><div>&nbsp;end</div><div>&nbsp;</div><div>&nbsp;but I got</div><div>&nbsp;Rule Compilation error : [Rule name='Sumatoria de lineas detalle vs Header']</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;rule/Rule_Sumatoria_de_lineas_detalle_vs_Header_0.java (9:1313) : The method eval(Double) is undefined for the type Rule_Sumatoria_de_lineas_detalle_vs_Header_0</div><div><br></div><div><br></div><div>&nbsp;</div><div>&nbsp;Any help in those tow problems</div><div>&nbsp;</div><div>&nbsp;TIA</div><div><br></div><div>Yamil</div></div>                                               <br /><hr />Actualízate gratis al nuevo Internet Explorer 8 y <a href='http://www.microsoft.com/spain/windows/internet-explorer/default.aspx' target='_new'>navega más seguro</a></body>
</html>