The fastest easiest way to get it right.

The Order Total

Now that order detail lines are being completely calculated, we wish to SUM the total of the order lines to the order total.

The SUM of Order Lines

Calculating a SUM is as easy as a FETCH. The two types of automation both depend on a foreign key. Whereas the FETCH sends information 'down' from a parent table to a child table, a SUM adds information 'up' from child rows to a parent row.

Maintaining a sum of all of the order lines is as easy as adding an automated column to the header:

column order_num:
   type_id: int
   description: Order Number
table orders_h:
   module: orders
   description: Orders
   
   column order_num:
      uisearch: "Y"
      primary_key: "Y"
      automation_id: SEQUENCE
   foreign_key customers:
      uisearch: "Y"
   
   column price_lines:
      suffix: _lines
      automation_id: SUM
      auto_formula: orders_d.price_extended

In the next tutorial we will review what we have created so far, and from there we will go on to add a credit limit constraint to our system.

User Comments

There are no user comments yet on this page.


Add A Comment

Comments will not appear until after they are moderated. Comments are usually moderated within a few hours on weekdays, but may take longer on weekends and holidays.

Name or nickname: (This will appear with your comment)


Email (this will never be displayed)


Enter your comment here. Use [b] and [/b] for bold, [i] and [/i] for italic, and [pre] and [/pre] for code samples. All literal HTML and PHP that you enter will be escaped out and displayed as you enter it.


Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2010, Licensed under the GPL Version 2