|
Documentation Programming With Andromeda Defining a Database
|
Previous: Calculating Extended Price
Next: Many-to-Many
Summing an OrderAs long as we have been working on the line items for an order, it would make sense to sum the order amounts up to the order, where we can calculate tax, freight and so forth. Assuming that the ORDER_LINES table has a column PRICE_EXT, as in the previous example, we can sum that up to the orders table pretty easily: table orders:
module: sales
description: Sales Orders
column price_lines:
suffix: _lines
automation_id: SUM
auto_formula: order_lines.price_ext
At this point it is worth repeating that the above automation only works because the ORDER_LINES table is a child table of the ORDERS table. That is, the order lines table has a foreign_key to the ORDERS table. Without the foreign key the whole concept of a SUM would be meaningless. Other automations in this category include MIN, MAX, COUNT and LATEST.
Previous: Calculating Extended Price
Next: Many-to-Many
|
