Sum row of entries of an order


Anyone know how I can write a method that takes all the rows of an order and counts a total sum for that order?

Simply write it as:

Select sum(field) from table // here, field is the amount which you want to calculate

where table.field1 == something // if any condition exists


info(strfmt(’%1’, table.field));


Actual Code:

you can create a display method under form datasource.

Take SalesTable as a example, there if you write under \Forms\SalesTable\Data Sources\SalesTable\Methods\totalLineAmount

here in above path “totalLineAmount” is the method which you are creating something like this:

display real totalLineAmount(SalesTable _sales)


Salesline line1;


Select sum(lineamount) from line1

where line1.SalesId == _sales.SalesId;

if (line1.LineAmount)


return line1.LineAmount;



return 0;


Once this is created you can drag it in to your form design.

lets say here : \Forms\SalesTable\Designs\Design[Group:Table][Tab:TabHeader][TabPage:TabHeaderOverview][Grid:GridHeader]\RealEdit:totalLineAmount