Sie sind auf Seite 1von 56

BusinessObjects

Designer Essentials
Alan Mayer & Penny Brewer
Version 1.0
November xx, 2004
Presentation Information

Alan Mayer & Penny Brewer


Integra Solutions, Inc.
Title: BusinessObjects Designer Essentials
Track Session Description
ƒ Make sure you really know the right way to design universes. Hear a
design methodology and established best practices that will help you
enhance the readability and performance of your universes. Learn
how to recognize specific design problems like fan or chasm traps
and the proper use of aliases, contexts, and shortcut joins. Attend
this “intelligent primer” and walk away with the essential techniques
for building effective and efficient universes.

Slide 2 Copyright © 2004 Business Objects S.A. All rights reserved.


Topics

Universe Definition
Tables
Joins
Loops
Aliases
Contexts
Chasm Traps
Fan Traps
Conclusion (Q&A)

Slide 3 Copyright © 2004 Business Objects S.A. All rights reserved.


Universe Definition 1/4

Webster’s Unabridged Dictionary


ƒ All created things viewed as constituting one system
or whole; the whole body of things, or of phenomena
WordNet
ƒ Everything that exists anywhere
HyperDictionary
ƒ The whole collection of existing things
AllWords
ƒ the whole of space and all the galaxies, stars, planets, moons,
asteroids and other bodies contained within it; the cosmos.

Slide 4 Copyright © 2004 Business Objects S.A. All rights reserved.


Universe Definition 2/4

BusinessObjects
ƒ The semantic layer seen by users as they query the database
ƒ Constructed from business terms they understand
ƒ Tables and joins predefined in the background

Universes Database Schema

Query Panel Database

Slide 5 Copyright © 2004 Business Objects S.A. All rights reserved.


Universe Definition 3/4

A universe contains
ƒ A structural representation of the database
ƒ A logical interpretation of the data retrieved

Universe Pane Structure Pane

Slide 6 Copyright © 2004 Business Objects S.A. All rights reserved.


Universe Definition 4/4

The Universe Creation Process


ƒ Define the database connection
ƒ Insert tables
ƒ Add joins between tables Structural
ƒ Resolve logical inconsistencies
ƒ Create classes and objects
ƒ Develop hierarchies
Logical
Today’s presentation will focus on structural topics

Slide 7 Copyright © 2004 Business Objects S.A. All rights reserved.


Tables 1/2

Tables, views, and synonyms can


be chosen from the Table Browser
ƒ Use the shortcut button
ƒ Right-click Structure Panel and
select Tables
Select the desired tables and drag
them onto the Structure Pane

Slide 8 Copyright © 2004 Business Objects S.A. All rights reserved.


Tables 2/2

The contents of the Table browser can be customized


using external strategies
ƒ Restricts the types of database objects retrieved
ƒ XML format new in Version 6
ƒ Refer to Designer manual for more information

</Strategy>
<Strategy Name=“Project Tables">
<Message id="Help">This strategy selects project tables.</Message>
<Message id="Name">External Strategy: Project Tables</Message>
</Strategy>

Slide 9 Copyright © 2004 Business Objects S.A. All rights reserved.


Joins 1/9

Relationships between tables can now be defined


Known as joins, these relationships can take many
forms
ƒ Inner join
ƒ Outer join
ƒ Theta join
ƒ Recursive join
ƒ Self-restricting join
ƒ Shortcut join
The next few slides will explain each join type

Slide 10 Copyright © 2004 Business Objects S.A. All rights reserved.


Joins 2/9
Inner Joins
Also known as equi-joins or normal joins
Usually take the the following form
ƒ Single join: Primary Key (PK) = Foreign Key (FK)
ƒ Compound Join: PK1 = FK1 and PK2 = FK2 and …

PK

City.city_id=Customer.city_id

FK

Slide 11 Copyright © 2004 Business Objects S.A. All rights reserved.


Joins 3/9
Outer Joins
Forces all rows from one table to be considered even if
no matching row exists in second table
ƒ For example: “Return all customers and orders if they exist”
ƒ Syntax varies based on database
ƒ Outer joins CASCADE! (see notes)

Oracle:
Customer.cust_id = Sales.cust_id (+)

DB2:
SELECT …
FROM Customer LEFT OUTER JOIN Sales
ON Customer.cust_id = Sales.cust_id

Slide 12 Copyright © 2004 Business Objects S.A. All rights reserved.


Joins 4/9
Theta Joins
Relates two tables using relationships other than
equality

Customer.age
BETWEEN
Age_group.age_min and
Age_group.age_max

Slide 13 Copyright © 2004 Business Objects S.A. All rights reserved.


Joins 5/9
Recursive Joins
A row is related to other row(s) within the same table
ƒ Example: A sponsor may be stored in the same table as their
referrals

Customer.sponsor_id = Customer.cust_id

Slide 14 Copyright © 2004 Business Objects S.A. All rights reserved.


Joins 6/9
Self-Restricting Joins
A condition that should ALWAYS be applied against a
table
ƒ A universal condition rather than a join
ƒ One way to force BusinessObjects to always add the condition to any
SQL statement that references that table

Country.country_id = 1

Slide 15 Copyright © 2004 Business Objects S.A. All rights reserved.


Joins 7/9
Shortcut Joins
Provides a shortcut or alternative path between tables
ƒ Example: The Customer table may contain an extra column that
allows a direct join to Country

Join Editor

Shortcut Join

Slide 16 Copyright © 2004 Business Objects S.A. All rights reserved.


Joins 8/9

Join cardinalities MUST be defined


ƒ Cardinality determines the number of rows related to a current row
ƒ They help resolve logical problems later

A salesperson has 1 customer;


1:1 A customer has 1 salesperson

A salesperson has 1 or more customers;


1:Many
A customer has one salesperson

Many: A salesperson has 1 or more customers;


Many A customer has 1 or more salespersons

Slide 17 Copyright © 2004 Business Objects S.A. All rights reserved.


Joins 9/9

Cardinalities can be established two different ways


ƒ Automatic Detection (not as good)
ƒ Manually via Join Editor (better)

Automatic
or

Manual

Slide 18 Copyright © 2004 Business Objects S.A. All rights reserved.


Loops 1/6

A loop is created when two or more paths exist between


tables
ƒ An employee can take a business trip to a country
ƒ An employee is born in a country

Employee Trips
Trips

Employees Countries

Slide 19 Copyright © 2004 Business Objects S.A. All rights reserved.


Loops 2/6

An Alternative Definition
ƒ “Loops represent pools of water that cannot escape”

Employee Trips
Trips

Employees Countries

Slide 20 Copyright © 2004 Business Objects S.A. All rights reserved.


Loops 3/6

What if Employee Name and Country were queried?


ƒ Older versions of BusinessObjects placed all available joins in the
query
ƒ This retrieved only those employees that traveled to their country of
origin!

Employee Trips
Trips

Employees Countries

Slide 21 Copyright © 2004 Business Objects S.A. All rights reserved.


Loops 4/6

Newer version prevent incorrect results


ƒ … by preventing the query altogether
ƒ If attempted, the user will see the following error message
ƒ Loops must be resolved to allow all possible valid queries

Slide 22 Copyright © 2004 Business Objects S.A. All rights reserved.


Loops 5/6

Detecting Loops
ƒ Always a good idea
ƒ Use the Detect Loops button (Tools / Detect Loops)

Slide 23 Copyright © 2004 Business Objects S.A. All rights reserved.


Loops 6/6

Printing Loops
ƒ Use the Integrity Check button (Tools / Check Integrity) to print loops

Slide 24 Copyright © 2004 Business Objects S.A. All rights reserved.


Chasm Traps 1/2

First look for logical traps


ƒ One of the most common is the Chasm Trap
ƒ Usually the result of a Many to One, One to Many relationship

N N

1 1

Countries

Countries is the trap!


ƒ Take a trip to England …
Trips Employees
ƒ … and be born in England?
CHASM

Slide 25 Copyright © 2004 Business Objects S.A. All rights reserved.


Chasm Traps 2/2

Other characteristics of chasms


ƒ Often caused by joining to lookup tables
ƒ The chasm cannot be crossed

Slide 26 Copyright © 2004 Business Objects S.A. All rights reserved.


Aliases 1/8

Aliases can resolve chasm traps


ƒ Known as table aliases when writing SQL statements
ƒ Used by BusinessObjects to logically separate the trap into pieces

SELECT a.country,
b.country Table aliases
FROM country a,
country b
Creating a alias in BusinessObjects
WHERE …

Slide 27 Copyright © 2004 Business Objects S.A. All rights reserved.


Aliases 2/8

Countries would be replaced by one (or two) aliases


ƒ Create an alias for each path
ƒ One alias is sufficient
ƒ Two aliases makes the diagram more readable

Employee Trips Destination_Countries


Trips (Countries)

Employees Countries

Nationality
(Countries)

Slide 28 Copyright © 2004 Business Objects S.A. All rights reserved.


Aliases 3/8

Generic lookup tables can be resolved using aliases

Before:
Lookups
Lookups
Type Code Description
SAL 001 Base Salary
SAL 002 Overtime After:
SAL 003 Company Car
ABS 001 Holiday Abs_Lookups
ABS 002 Sick (Lookups)
ABS 003 Sick of Job
Sal_Lookups
(Lookups)

Slide 29 Copyright © 2004 Business Objects S.A. All rights reserved.


Aliases 4/8

Recursive relationships can also be resolved


ƒ The depth of those relationships should be known
ƒ For example: How many organization levels?
How many part levels?

Before:

Employees Employees
Emp_ID Name Manager_ID
1 Mayer 5
5 Smith 23 After:
23 Betten 42 Employees Managers
42 Byrd (Employees)

Slide 30 Copyright © 2004 Business Objects S.A. All rights reserved.


Aliases 5/8

Every loop can be resolved with aliases, BUT …


ƒ There are drawbacks to using aliases
ƒ More business terms (objects) will be added
ƒ Those additional terms may confuse some users
ƒ Aliases also CASCADE

Problem #1 Problem #2

Slide 31 Copyright © 2004 Business Objects S.A. All rights reserved.


Aliases 6/8

Adding aliases in BusinessObjects


ƒ In the following structure, Country is a chasm trap
ƒ Since chasms cannot be crossed, two aliases will separate the paths

Slide 32 Copyright © 2004 Business Objects S.A. All rights reserved.


Aliases 7/8

Aliases can be manually added


ƒ Use the Insert Alias button after selecting a table
ƒ Right-click on a table and choose “Alias”

Slide 33 Copyright © 2004 Business Objects S.A. All rights reserved.


Aliases 8/8

Aliases can be automatically added


ƒ BusinessObjects can suggest possible aliases for you
ƒ Be careful!!
ƒ Just because an alias CAN be added doesn’t mean it SHOULD

Slide 34 Copyright © 2004 Business Objects S.A. All rights reserved.


Contexts 1/7

An alternative method to resolve loops is by creating


Contexts
A context represents one path or set of joins between
tables
Context #1: Trips

Employee Trips
Trips

Employees Countries

Context #2: Nationality

Slide 35 Copyright © 2004 Business Objects S.A. All rights reserved.


Contexts 2/7

A context contains each join in the path

Context #1: Trips


Employees.emp_id = Employee_Trips.emp_id
Employee_Trips.trip_id = Trips.trip_id
Trips.country_id = Countries.country_id

Context #2: Nationality


Employees.country_id = Countries.country_id

Slide 36 Copyright © 2004 Business Objects S.A. All rights reserved.


Contexts 3/7

Contexts are associative


ƒ Longer join paths will resolve loops caused by smaller paths

Context #1 Context #1 Context #2


AB AD
B C BC DE
CD EF

A D DE
EF

Context #2 F

Slide 37 Copyright © 2004 Business Objects S.A. All rights reserved.


Contexts 4/7

A contexts acts like a “roadmap of available path”


ƒ Once chosen, other joins not in the context disappear
ƒ Add as many additional joins to the context as needed
ƒ Always add new joins to at least one context

B C
Context #1 Context #2

A D AB AD
BC DE
CD EF
Z E
DE
EF
F

Slide 38 Copyright © 2004 Business Objects S.A. All rights reserved.


Contexts 5/7

Contexts resolve the loop when the query is run rather


than in the Designer
ƒ This means that a context-based solution still has loops!
The user may be asked to choose between the contexts
ƒ BusinessObjects will try to infer which context to use
ƒ If it can’t figure it out, the user usually chooses a context
Once a context is chosen, all other joins “disappear”
ƒ Only joins listed in the context will be used to build the final SQL
program
Using contexts does not force additional objects

Slide 39 Copyright © 2004 Business Objects S.A. All rights reserved.


Contexts 6/7

Contexts can be manually added


ƒ The designer can add/subtract joins according to business rules

Slide 40 Copyright © 2004 Business Objects S.A. All rights reserved.


Contexts 7/7

Contexts can be detected


ƒ Be careful!! Not all suggested contexts make business sense

Slide 41 Copyright © 2004 Business Objects S.A. All rights reserved.


Alternative Loop Resolutions 1/5

Shortcut joins can be used to resolve loops


ƒ Be careful!!
ƒ This technique may cause more problems than solutions
ƒ Remember the alternative definition of loops

Slide 42 Copyright © 2004 Business Objects S.A. All rights reserved.


Alternative Loop Resolutions 2/5

Problem #1
ƒ A shortcut join “dissolves” the normal join relationship
ƒ For the following query, only guests that have past and future activity
will be returned

Slide 43 Copyright © 2004 Business Objects S.A. All rights reserved.


Alternative Loop Resolutions 3/5

Problem #1 Results
ƒ For the following query, only guests that have past and future activity
will be returned

Slide 44 Copyright © 2004 Business Objects S.A. All rights reserved.


Alternative Loop Resolutions 4/5

Problem #2
ƒ In this scenario, no known path exists to Service
ƒ A query cannot be written without a Cartesian Product

Slide 45 Copyright © 2004 Business Objects S.A. All rights reserved.


Alternative Loop Resolutions 5/5

Problem #2 Results
ƒ The join from Service to any other table is missing!

No join to Service

Slide 46 Copyright © 2004 Business Objects S.A. All rights reserved.


Fan Traps 1/9

Fan traps hide in Master-Detail-Detail relationships


ƒ Trouble occurs when aggregating on a Master column

Sales Invoice_Line
inv_id … max_ inv_id service_id … nb_
guests guests
23102 10 23102 211 4
23103 8 23102 221 3
23104 5 …

Slide 47 Copyright © 2004 Business Objects S.A. All rights reserved.


Fan Traps 2/9

Create query for Actual vs Budgeted Guests for


Invoice 23102
Invoice: Sales.inv_id
Budgeted Guests: sum(Sales.max_guests)
Actual Guests: sum(Invoice_line.nb_guests)

Slide 48 Copyright © 2004 Business Objects S.A. All rights reserved.


Fan Traps 3/9

What happened?
ƒ Two detail lines for Invoice 23102
ƒ Budgeted Guests is overstated by a factor
ƒ (10 guests budgeted) * (2 detail lines) = 20 guests

Result Set
Invoice Budgeted Actual (Budgeted Guests) *
Guests Guests (Number of detail lines)
23102 10 3
23102 10 4
Totals: 20 7

Slide 49 Copyright © 2004 Business Objects S.A. All rights reserved.


Fan Traps 4/9

Solution #1
ƒ Create a separate SQL statement per aggregation
ƒ Aggregations on the same table require only 1 SQL statement

File /
Parameters
from main
menu

Slide 50 Copyright © 2004 Business Objects S.A. All rights reserved.


Fan Traps 5/9

Multiple SQL statements return the correct answer

Slide 51 Copyright © 2004 Business Objects S.A. All rights reserved.


Fan Traps 6/9

What if the Detail table isn’t aggregated


ƒ Perhaps a user wants the services associated with a sale

Service
inv_id … service
211 Hotel Room
221 Restaurant

Sales Invoice_Line
inv_id … max_ inv_id service_id … nb_
guests guests
23102 10 23102 211 4
23103 8 23102 221 3
23104 5 …

Slide 52 Copyright © 2004 Business Objects S.A. All rights reserved.


Fan Traps 7/9

Create query for Budgeted Guests by Service for


Invoice 23102
Invoice: Sales.inv_id
Budgeted Guests: sum(Sales.max_guests)
Service: Service.service

Slide 53 Copyright © 2004 Business Objects S.A. All rights reserved.


Fan Traps 8/9

Is there a problem?
ƒ Guests are budgeted at the invoice level, not service level
ƒ Summing the Budgeted Guests would be a mistake

Not good

Slide 54 Copyright © 2004 Business Objects S.A. All rights reserved.


Fan Traps 9/9

Possible solutions
ƒ Budget guests at a lower level of detail
ƒ Prevent this query from occurring (drastic)
ƒ Create a “smarter” report that realizes that budgeted guests can
only be represented at the invoice level
More advanced solutions are possible
ƒ Aggregate-aware techniques
ƒ Alias/Context solutions (brittle)
ƒ Data warehouse / data mart

Slide 55 Copyright © 2004 Business Objects S.A. All rights reserved.


Questions & Answers

Alan Mayer
amayer@integrasolutions.net
(214) 637-6622

Penny Brewer
pbrewer@integrasolutions.net
(214) 637-6622

Slide 56 Copyright © 2004 Business Objects S.A. All rights reserved.

Das könnte Ihnen auch gefallen