To solve loop
The most common use of contexts is to separate two query paths, so that one query returns data for one fact table, and the other query returns data for another fact table. You use contexts to direct join paths in a schema which contains multiple fact tables. Alias are not appropriate in such schema.
You often use context in schema that contain multiple fact tables (“multiple stars”) that share lookup tables.
To solve chasm and fan traps
Contexts are also used to solve potential BOBJ - Chasm Traps (converging many to one joins). These can occur when two many-to-one join paths converge on a single table. Multiple rows can be returned for a single dimension causing inflated results. Contexts can split out the query so that the correct number of rows are returned for the dimension. Contexts can also be used with BOBJ - Alias to solve BOBJ - Fan Trap (serial many to one joins).
Using contexts to determine AggregateAwareness incompatibility
You can use contexts to exclude objects that are not compatible with an object using the @AggregateAware function in its definition, from being used in a query with the aggregate aware object.
Automatically with Detect Context
Tools > Automated Detection >Detect Contexts
Detect Contexts examines the many to one joins in the schema. It picks up the table that receives converging many to one joins and proposes contexts to separate the queries run on the table.
- Insert > Context
- View > List Mode
- Double click a context name in the Contexts list pane. The Edit Context box appears
- Ensure that List mode is active (Select View > List Mode).
- Right click a context name in the Contexts list box and select Clear from the contextual menu.
Click a context and click the Rename button.
One-to-one cardinality preventing context detection
A one-to one-cardinality positioned at the end of a join path can prevent Context Detection in Designer from detecting a context. You resolve this problem by changing the cardinality of the table at the end of the join path to one-to-many.
Objects from two different contexts are combined in a query. The two Select statements are synchronized to display returned data in separate tables.
To allow incompatible queries to be run in Web Intelligence, you must select the Multiple SQL statements in Designer for each context option.
- File > Parameters.
- Click the SQL tab.
- Select the Multiple SQL statements for each context check box