Siebel Reports Administration Guide > Sorting Records in Memory >

Report Sorts Records from a Many-to-Many Relationship


Memory sorting is also employed when master and detail business components have a many-to-many relationship, such as between opportunities and contacts or between accounts and opportunities. An example of this situation is the Contacts By Opportunity report, obtained in the Contacts screen by choosing View > Reports, then selecting By Opportunity from the drop-down menu and clicking Run Now.

The situation in this report is very similar to the one in the Opportunities by Sales Rep report, in that there are multiple detail records for each master, and the master records are to be sorted by a field in the detail records. You want to print contacts sorted by opportunity, which requires looking at the many-to-many relationship from the perspective of one opportunity to many contacts.

The set of object definitions in Siebel Tools uses the Opportunity business component as the master and includes a contact subreport. In the report design, merged opportunity records are created in a memory structure with the contact name included as an extra field. They are then sorted into contact order and printed with contact group breaks.

Notice that this could easily be switched around to create a report that prints contacts sorted by opportunity. The exported data supply library would use Contact as the business component in the master report object definition, and Opportunity in the subreport. In the report design, the structure in memory would hold the contents of each contact record plus an opportunity name field. The contact records would sort in opportunity order, with opportunity group breaks.

This report is analyzed in greater detail in Examining a Report Based on a Many-to-Many Relationship.


 Siebel Reports Administration Guide, Version 7.5, Rev B 
 Published: 18 April 2003