MoneyWorks Manual
SumDetail ("expression", detail.searchExpr [, transaction.searchExpr])
Result Type: Number
Definition: Used to get the sum of the nominated expression (which should return a numeric result) for the found detail lines of the found transactions. The detail lines to be found are identified in the first search expression, whereas the second expression identifies which transactions to choose. If the transaction search is not specified, all transactions will be searched.
Examples:
SumDetail("detail.stockqty", "detail.stockcode = \"CA100\"", "type = \"CI@\" and transdate > '30/4/06')")
Returns the quantity of product CA100 purchased since April 06.
SumDetail("detail.stockqty*(detail.unitprice - detail.costprice)", "detail.stockcode = \"B@\"", "type = \"DI@\" and period = datetoperiod('30/4/06')")
Returns the total margin on all products starting with “B” that were invoiced in April 2006.
See Also:
CreateSelection: Create a selection of records
DisplaySelection: Display standard list window for a given selection of records
IntersectSelection: Intersect a selection with the result of another search
RecordsSelected: Count records in a selection or resulting from a (meta) search
SumSelection: Add up a field for records matching a search
UnionSelection: Add the result of another search to a selection