Highlighted

dynamics tables: calculation

Avatar

15-07-2008

Hi,<br /><br />I've created a dynamic table. I'd like to calculate s.th. with dynamically added rows which looks like this:<br /><br /> working hours<br /><br /> dynamic row<br /><br /> dynamic row<br /><br /> ...<br /><br />sum = sum of dynamic rows<br /><br />I found this code snippet in another forum which should do the work but unfortunately nothing is calculated:<br /><br />var flds = this.resolveNodes("$form..Travelinghrs[*].Amount");<br /><br />var sum = 0;<br />for (var i=0;i<flds.length;i++)<br />{<br />if (isNaN(flds.item(i).rawValue))<br />sum+=flds.item(i).rawValue;<br />}<br />sum;<br /><br />I got a big table with many columns. What I want to do, is calculate the amount of all travelling hours entered in the dynamically added cells "Travelinghrs". As far as I understand the code, it should work. I changed the cells to "numeric field". When I change to the pdf-preview, there is a "0" in the travelh_sum field but its not calculated. Maybe I can send you my pdf file...I dont want to upload it here for public access..<br /><br />Thanks in advance<br /><br />Martin