AgileApps Support Wiki Pre Release

Difference between revisions of "Master-Detail relationship"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
==About Master-Detail Relationships==
A Master-Detail relationship is a one-to-many association between two objects, where detail records only exist when there is a master record to point to.
A Master-Detail relationship is a one-to-many association between two objects, where detail records only exist when there is a master record to point to.


Line 7: Line 6:
:* Inventory, where where ''shoe style'' is a master record, while detail records specify the ''size and color'' of shoes in stock.
:* Inventory, where where ''shoe style'' is a master record, while detail records specify the ''size and color'' of shoes in stock.


For example, consider an order management system, the Master object is ''Orders'' and the Detail object is ''Order Items''. Together, an invoice can be prepared from the records. Each line in the invoice can display the number of items ordered, the unit price, and line item total, taken from the detail records. Sales tax and sub-totals, meanwhile, can be calculated and stored in the master (invoice) record.
For a more detailed example, consider an order management system, where the Master object is ''Orders'' and the Detail object is ''Order Items''. Together, an invoice can be prepared from those records. Each line in the invoice can display the number of items ordered, the unit price, and the line item total, using values taken from the detail records. Sales tax and sub-totals, meanwhile, can be calculated and stored in the master (invoice) record.


When an order is deleted in a system like that, then all associated line items should be deleted as well.  
In addition, when an order is deleted in a system like that, then all associated line items should be deleted as well.  


In {{EnterpriseBrand}}, [[Rollup Summary Fields]] are used to do calculate the line item totals, and [[Cascade Rules]] are used to auto-delete detail records when a master record is deleted.
In the {{EnterpriseBrand}}:
:* [[Rollup Summary Fields]] are used to do calculate the line item totals.
:* [[Cascade Rules]] are used to auto-delete detail records when a master record is deleted.
:* [[Subforms]] are typically used to view and modify detail records while entering or editing a master record.


{{Note|There used to be an option to specify "Master-Detail relationship" when creating a Lookup field. That option became redundant, however, and has been removed. [[Rollup Summary Fields]] and [[Cascade Rules]] achieve the same goals, but they work across multiple related objects--not just those that have a particular flag set on the Lookup field that connects them.}}
{{Note|There used to be an option to specify "Master-Detail relationship" when creating a Lookup field. That option became redundant, however, and has been removed. [[Rollup Summary Fields]] and [[Cascade Rules]] achieve the same goals, but they work across multiple related objects--not just those that have a particular flag set on the Lookup field that connects them.}}

Latest revision as of 20:14, 30 July 2014

A Master-Detail relationship is a one-to-many association between two objects, where detail records only exist when there is a master record to point to.

Examples of Master-Detail relationships include:

  • Invoices, where items in an order are detail records, and pricing or discounts are fields in the master record (the invoice)
  • Timesheets, where employees are master records, and hours worked are detail records
  • Inventory, where where shoe style is a master record, while detail records specify the size and color of shoes in stock.

For a more detailed example, consider an order management system, where the Master object is Orders and the Detail object is Order Items. Together, an invoice can be prepared from those records. Each line in the invoice can display the number of items ordered, the unit price, and the line item total, using values taken from the detail records. Sales tax and sub-totals, meanwhile, can be calculated and stored in the master (invoice) record.

In addition, when an order is deleted in a system like that, then all associated line items should be deleted as well.

In the AgileApps Cloud platform:

  • Rollup Summary Fields are used to do calculate the line item totals.
  • Cascade Rules are used to auto-delete detail records when a master record is deleted.
  • Subforms are typically used to view and modify detail records while entering or editing a master record.

Notepad.png

Note: There used to be an option to specify "Master-Detail relationship" when creating a Lookup field. That option became redundant, however, and has been removed. Rollup Summary Fields and Cascade Rules achieve the same goals, but they work across multiple related objects--not just those that have a particular flag set on the Lookup field that connects them.