Professional Documents
Culture Documents
Designers Dilemmas
Quick Hits
Number of rows in table For Oracle use REVERSE_TABLE_WEIGHT=Y in prm file (Default) REVERSE_TABLE_WEIGHT only valid for Oracle
68 Dow ning Street6/27/1996 17montee des Chenes 4/23/1997 91 Torre drive The Gables 34 Apple Grove 70 Kiroto Street 10 Hamilton Park 4/1/1997 5/23/1997 9/10/1996 9/8/1997 8/4/1998
Customer.address,
Reservations.res_date FROM Customer, Reservations
WHERE
( Customer.cust_id=Reservations.cust_id ) AND ( ( Reservations.res_date=ANY(SELECT max(T1.res_date) from Reservations T1 WHERE T1.cust_id = Reservations.cust_id) ) )
BusinessObjects parser will not see the Customer table hidden within the SELECT unless other objects from the Customer table are included in the query To ensure this manually add the table to the list of implicated tables
Click
Chasm trap is a limitation of SQL The Chasm trap occurs when two many-to
one joins converge on a single table. Results in a partial Cartesian product
10
11
Cust Id
Cust Id Loan Id Loan Date 10 10 19 19 190 8/5/1998 397 6/3/1999 236 12/13/1998 459 7/19/1999
12
Detail results
Cust Name Paul
Cust Nam e Paul Paul Paul Paul Paul Paul
SELECT Customer.cust_name,
Loan Date Loan Am ount 8/5/1998 8/5/1998 8/5/1998 6/3/1999 6/3/1999 6/3/1999 5,000 5,000 5,000 10,000 10,000 10,000
Pauls
totals incorrect
should be 15,000 should be 43,000
Orders
WHERE
Loans
Orders
Pauls Mary
13
Tip 3: Chasm
Select the option Multiple SQL Statements for Each Measure from the Universe Parameters dialog box.
Only applies to measures. You force the SQL generation engine in Reporter to generate SQL queries for each measure that appears in the Query panel. You cannot use this solution to generate multiple SQL statements for dimensions. Option is on by default.
14
Two
Paul Paul Paul Paul Paul Paul
SELECT Customer.cust_name, Loans.loan_date, Orders.order_date, sum(Orders.order_value) FROM Customer, Loans, Orders WHERE
Cust Nam e Loan Date Order Date Loan Am ount Order V alue
Loan Amount
( Customer.cust_id=Loans.cust_id )
AND ( Customer.cust_id=Orders.cust_id ) GROUP BY Customer.cust_name, Loans.loan_date, Orders.order_date
( Customer.cust_id=Loans.cust_id )
AND ( Customer.cust_id=Orders.cust_id ) GROUP BY Customer.cust_name,
Customer
Loans.loan_date, Orders.order_date
Mary
Pauls
15
Tip 3: Chasm
Define a context for each table at the "many" end of the joins.
In our example you could define a context from CUSTOMER to ORDERS and from CUSTOMER to LOANS. This creates two SQL statements and two separate tables in Business Objects, avoiding the creation of a Cartesian product. Using contexts is the most effective way to solve Chasm traps.
16
Tip 3: Chasm
Define a context for each table at the "many" end of the joins.
Multiple SQL statements for each context must be selected. It is checked by default. If not you will receive the Incompatible Objects error message.
17
Loan Amount
Order Date
1/31/1999 6/4/1999 Sum:
Order Value
12,000 4,000 16,000
Mary
Loan Date
12/13/1998 7/19/1999 Sum:
sum(Orders.order_value) FROM
Loan Am ount
7,000 2,000 9,000
Order Date
Sum:
Order Value
Customer, Orders
WHERE
( Customer.cust_id=Orders.cust_id ) GROUP BY Customer.cust_name,
WHERE
( Customer.cust_id=Loans.cust_id ) GROUP BY Customer.cust_name, Loans.loan_date
Paul
Loan Date
8/5/1998 6/3/1999 Sum:
Orders.order_date
Loan Am ount
5,000 10,000 15,000
Order Date
1/12/1999 4/14/1999 9/20/1999 Sum:
Order Value
10,000 15,000 18,000 43,000
18
join, while still joining to the "many" end For example, a query is run that asks for the total orders by each order line, for a particular customer
19
3 1 5 3
20
Paul
3 1 5 9
Paul
Sum :
Custom er Nam e Product Total V alue Quantity Sold Pete Pe te Kia Sum : 23,000 23,000 3 3
SELECT Customer.cust_name, sum(Orders.total_value), sum(Order_Lines.qty_sold) FROM Customer, Orders, Order_Lines WHERE ( Customer.cust_id=Orders.cust_id ) AND ( Orders.order_id=Order_Lines.order_id )
sum(Order_Lines.qty_sold), Order_Lines.prod_id
FROM Customer, Orders, Order_Lines WHERE ( Customer.cust_id=Orders.cust_id ) AND ( Orders.order_id=Order_Lines.order_id ) GROUP BY Customer.cust_name, Order_Lines.prod_id
GROUP BY
Customer.cust_name
21
Results
Expected answer:
Paul Pete $ 550,000 9 Cars $ 23,000 3 Cars $1,650,000 9 Cars $ 23,000 3 Cars
22
23
SELECT Customer.cust_name, sum(Order_Lines.qty_sold) FROM Customer, Order_Lines, Orders WHERE ( Customer.cust_id=Orders.cust_id ) AND ( (Orders.order_id=Order_Lines.order_id ) GROUP BY Customer.cust_name
Customer, Orders
WHERE ( Customer.cust_id=Orders.cust_id ) GROUP BY Customer.cust_name
Results
are correct
But..
24
SELECT Customer.cust_name, Order_Lines.prod_id, sum(Orders.total_value) FROM Customer, Order_Lines, Orders WHERE ( Customer.cust_id=Orders.cust_id ) AND ( Orders.order_id=Order_Lines.order_id ) GROUP BY Customer.cust_name, Order_Lines.prod_id
Cust Nam e Pete Pe te Total Value 23,000 23,000 Quantity Sold 3
SELECT Customer.cust_name, Order_Lines.prod_id, sum(Order_Lines.qty_sold) FROM Customer, Order_Lines, Orders WHERE ( Customer.cust_id=Orders.cust_id ) AND ( Orders.order_id=Order_Lines.order_id ) GROUP BY
Customer.cust_name,
Detail
Order_Lines.prod_id
25
Adding Dimensions or details from the Many side of the relationship will cause inflated results.
In our example, the Prod Id is the added dimension from the many side
26
27
Two
Context
Correct
used
results
SELECT Customer.cust_name, Order_Lines.prod_id, sum(Order_Lines.qty_sold) FROM Customer, Order_Lines, Orders WHERE ( Customer.cust_id=Orders.cust_id ) AND ( Orders.order_id=Order_Lines.order_id )
Pete
Total Value 23,000 Prod Id Kia Quantity Sold 3
SELECT Customer.cust_name, sum(Orders2.total_value) FROM Customer, Orders Orders2, Orders WHERE ( Customer.cust_id=Orders.cust_id ) AND ( Orders.cust_id=Orders2.cust_id and Orders.order_id=Orders2.order_id ) GROUP BY Customer.cust_name
GROUP BY
Customer.cust_name, Order_Lines.prod_id
28
29
30
31
For the Sales Revenue object, attempt to get the Sales Revenue figure from the year_quarter_agg_table table first, if that cant be done then try the year_quarter_month_week_agg_table next. And so on. The decision as to whether a particular table is chosen is made by reference to the Aggregate Navigation rules which are setup separately.
32
Step 1: Create summary tables Step 2: Define @AggregateAware objects Step 3: Define incompatibilities Step 4: Consolidate dimensions Step 5: Define contexts to separate levels of aggregation
33
34
Speed
Notice how the expressions are arranged, with the most summarized or fastest calculations on top
35
In Designer, identify which summary tables and objects cannot be used in the same query
36
37
class shows an empty checkbox, individual dimensions in that class may be selected, ie. Store\State
If
a class is selected, all objects in that class are also selected, ie. Product
This
aggregate table contains Year, Quarter, Month, Week but not Holiday. So Holiday is incompatible.
The
aggregate table contains City and Store Name but not State or any of the Store Details. So State and all the Store Details are incompatible.
38
aggregate table contains only Year and Quarter. So the remaining Time objects are incompatible.
The
aggregate table contains just State from the Store class. So the remaining Store objects are incompatible.
39
Year is stored in the summary tables as well as the Calendar dimension Based on number of rows, the summary tables would retrieve values faster Objects other than measures can be consolidated using aggregate aware techniques
@Aggregate_Aware( Agg_yr_qt_mt_mn_wk_rg_cy_sn_sr_qt_ma.Year, Agg_yr_qt_rn_st_ln_ca_sr.Year, Calendar_year_lookup.Year)
40
The summary tables presented so far were isolated not joined to any other table Many summarized tables can be joined by keeping one or more foreign keys from the original fact table The Annual_Shop_facts table summarizes revenue by year, product, and store
41
42
Loops within the universe will prevent queries from running Contexts can be used to separate the levels of aggregation, and break the loop
43
44
Each universe connection must point to same database Only one level of linking allowed No duplicate class names All related universes in same universe domain Care must be used in migrating from one universe domain to another such as Development to Production Contexts and Hierarchies will not carry over to linked universes If being used, Table Weights must be applied to all universes involved Use CORE_ORDER_PRIORITY=Y in prm for automatic modification of an objects status in a derived universe from the core Do not mix approaches
45
Three approaches
Kernel contains core common elements Master contains all elements Component merging universes Insert menu, select Universe to bring in the kernel universe Edit menu, select Links to alter linked universes
Include will bring in kernel as part of the universe, destroying the link Change Source normally used in universe migration Remove Link does exactly that
Kernel universes and their associated classes\objects will always appeared grayed out
46
Kernel approach
Kernel
Kernel contains core common elements Add specific components Kernel of the linked universes automatically updated Bring in kernel universe Use table browser to add new tables Join new tables into kernel Add new classes\objects from new tables Add new class\objects from kernel
Designer
Kernel
47
Master approach
Master
Master contains all Hide unnecessary objects Only one universe to maintain
Designer
Bring in kernel universe From the Insert menu select Universe As in normal universe, right click on an object or class and select Hide
48
Component approach
Merging two or more universes into one View several subuniverses as a whole
Designer
Insert multiple universes Universes must be joined by at least two tables Create new classes\objects
49
End of presentation
50