I am repurposing the script. Currently it only pulls the first row but I need it to pull all rows in the aggregate. I have tried getting it to work but all my changes break it. I need to go through and sum two different fields and then I will do some math with the totals. This currently works with the first line in the aggregate but I need it to total all lines in the aggregate.
Here is the script.
//COMPONENT NAME is what you put in the custom page element 'component type' property. <br>skuid.componentType.register('TotalMargin',function(element){ <br><br>var $ = skuid.$;<br>var m = skuid.model.getModel('InvoiceLine'); //Name of your model<br>var row = m.getFirstRow(); //Using an aggregate model that only returns one row. <br>//Field name from your aggregate model<br>var cost = row.sumCost; <br>var total = row.sumTotalDue;<br><br><br>var MathValue = (total-cost).toFixed(2); //Do your math here<br>element.append(<br> m.mergeRow(row,MathValue)<br> );<br>});



