Professional Documents
Culture Documents
Derived table is not a physical in database however its logical table created in Business Objects Universe
using SQL. Derived table can be considered like views in database where its structure is defined using
SELECT statement.
Create Derived table in universe Designer:
Either goes to Insert Derived table or right click in the universe Structure and click Derived table, the
new Derived table editor will open.
Many levels of nested derived tables can be created using @derivedTable function. Example, You
have Derived table DRV_SALES and want create another derived table by using DRV_SALES, then
create Select * from @Derived Table(DRV_SALES). Nesting derived table is limited to 20 levels.
Advantages:
SQL Statements with complex joins, expressions and conditional prompts can be used to create
derived tables when those are not possible in BO universe through normal tables.
Derived table will reduce the amount of data returned to the document for analysis.
Derived tables can be used as a normal table in the universe and do join with other tables.
To Update / Change the derived table structure in the universe is very easy.
You can merge data from different table which is not possible using normal in universe using
Disadvantages:
Derived table cause poor performance of the report because the derived table do not stored the data
Derived tables may cause memory issue on the server, if the database tables used in the derived
Use only when you need complex joins and calculations between tables in the BO universe then go
Join:
A join is a condition that links the data in separate but related tables. The tables usually have a
parent-child relationship. If a query does not contain a join, the database returns a result set that
contains all possible combinations of the rows in the query tables. Such a result set is known as
a Cartesian product and is rarely useful.as they allow you to combine data from multiple tables
in a meaningful way.
You have several approaches to creating joins in Designer:
Tracing joins manually in the schema.
Defining join properties directly.
Selecting automatically detected joins.
Automatically creating joins on table insertion.
3. Outer Join: Outer join links two tables using a join operator. When tables are linked using
outer joins the select query returns all the records which matches the join condition and returns
all the records from one table even though do not match the join condition.
(Or) Link two tables, one of which has rows that do not match those in the common column
of the other table. There are two types of outer join
Left Outer join: This outer join returns all the records from left table even when they do match
the join condition.
Right Outer join: This outer join returns all the records from right table even when they do
match the join condition.
4. Shortcut Joins: A shortcut join is a join that provides an alternative path between two tables.
Shortcut joins improve the performance of a query by not taking into account intermediate
tables, and it reduces number of joins in a query. Shortcut join is represented by dotted line in designer.
5. Self-restricting joins: Self restricting join is not actually a join but a restriction on a table.
Generally it is used to restrict the data returned by a table. To create a self-restricting join
1. Click on Insert menu and click on join to create new join
2. Select the table on which you want to create self-restricting join.
3. Select the same table name from table 2 combo box also.
4. Select the column which should be used for self-restricting join.
5. Edit the expression and put the restriction condition
6. Click ok
.
Cardinality of self-restricting join should be set to 1:1 otherwise it gives error while detecting contexts.
Fact Table: A fact table contains statistical information about transactions. For example,
it may contain figures such as Sales Revenue or Profit. In a universe, most but not all,
measures are defined from fact tables.
dddsddfdsfsd
Defining aliases:
Aliases are references to existing tables in a schema. An Alias is a table that is an exact
duplicate of the original table (base table), with a different name. The data in the table is exactly
the same as the original table, but the different name "tricks" the SQL of a query to accept that
you are using two different tables.
An alias is used when the same table is used more than once, and is typically indicated by that
table always being on the one side of a one-to-many joins.
A common use of alias is when a lookup table needs to be referenced several times in a query
and when different join rules exist for the lookup table. The alias allows for the lookup table to
be included multiple times in a universe and allows for the correct join rules to be associated
with the lookup table.
To use the table more than once in a query. This is the main reason for using aliases, and
includes using aliases to solve loops and fan traps.
Defining contexts:
Contexts are a collection of joins which provide a valid query path for Web Intelligence to
generate SQL.
They are used to resolve loops (and other SQL traps) and are indicated by tables always
appearing on the many side of a one-to-many join.
A context is a rule by which the report user can decide which path to choose when more than
one join path exists in query from one table to another table.
Solving loops, solving chasm traps.
Resolving loops:
In a relational database schema, a common type of join path that returns too few rows is called
a loop. A loop is a set of joins that defines a closed path through a set of tables in a schema.
Loops occur when joins form multiple paths between lookup tables.
Loops can be resolved by Alias, context.
You will get incorrect results only when all the following conditions exist:
A "many to one to much relationship" exists among three tables in the universe structure.
Query includes objects based on two tables both at the "many" end of their respective joins.
There are multiple rows returned for a single dimension.
If you have two fact tables with many to one joins converging to a single lookup table, then you
have a potential chasm trap. Creating contexts will always solve a chasm trap in a universe.
When you have dimension objects in one or both fact tables, you should always use context.
When you run queries on the tables in the chasm trap, the query is separated for measures and
dimensions defined on the affected tables.
Like for the example below, where a customer can have multiple sales and also have multiple
purchases.
These tables are connected in the following way, classes and objects created from this table list:
Query 1
Id
Query 2
C Name
Purchase Value
Id
C Name
Sale Value
101 Ashish
11,000
101 Ashish
6,000
102 Gaurav
7,000
102 Gaurav
4,000
Correct Results
Correct Results
Query3
Id
C Name
Purchase Value
Sale Value
101 Ashish
33,000
12,000
102 Gaurav
7,000
4,000
Wrong Results
Note:
In Query 1 purchase value of Ashish is coming correctly; in Query2 sale value is coming
correctly.
In Query 3, I used both purchase value and sale value in one query and it can be seen that the
results are inflated for Ashish.
But the result for Gaurav is still correct.
Now we will bring more objects in the query to see where exactly the problem is:
Id
Id
C Name
C Name
Sale Dt
Sale Value
2010-01-01
1,000
101 Ashish
2010-02-01
2,000
101 Ashish
2010-01-10
5,000
101 Ashish
2010-02-10
6,000
101 Ashish
2010-03-01
3,000
102 Gaurav
2010-01-10
7,000
102 Gaurav
2010-01-01
4,000
Query1
Query2
Query3
Id
C Name
Purchase Dt Sale Dt
Purchase Value
Sale Value
101 Ashish
2010-01-10
2010-01-01
5,000
1,000
101 Ashish
2010-01-10
2010-02-01
5,000
2,000
101 Ashish
2010-01-10
2010-03-01
5,000
3,000
101 Ashish
2010-02-10
2010-01-01
6,000
1,000
101 Ashish
2010-02-10
2010-02-01
6,000
2,000
101 Ashish
2010-02-10
2010-03-01
6,000
3,000
102 Gaurav
2010-01-10
2010-01-01
7,000
4,000
Mostly by analysis. When you are creating the universe, you should look for join
conditions (n:1:n) and definitely the inflation of results in reporting.
Detect Context in universe designer can help to analyze possible contexts, which says
there could be a trap, which needs to be resolved.
Now if I select sale value and purchase value in same query, it will generate below sql.
C Name
Purchase Value
Sale Value
101 Ashish
11,000
6,000
102 Gaurav
7,000
4,000
If the definition of measure is like above than it will not create two sql, even if option is checked.
We need to have the deifintion as:
Note: this method will also not work if we select dimension objects from many end of the query
as two select will not be generated and will still display inflated results.
2. Another method which will resolve this issue is by Context, which is the most acceptable one.
Create two contexts like below:
If you dont click on this check box, using objects from purchase and sales in a single query will
fetch Incompatible objects error.
By clicking on this check box, will give two queries for each context, both in case of measure or
dimensions coming from many end of tables.
Id
C Name
Purchase Value
Sale Value
101 Ashish
11,000
6,000
102 Gaurav
7,000
4,000
This will resolve Chasm trap and will correct results in query.
Fan Trap:
This is also a join path problem created in universe when below scenarios are met:
Consider table A, B and C.
Measures selected from Table B and any kind of object from Table C AND
This trap can also be created when we are having only two tables say B and C with One to
Many relationship, where we are using dimension and measure (which is aggregation of a
column in C) and an object from C table.
The results will be inflated like Cartesian product.
For eg:I have three tables
Correct result
Id Sales
C Name
Sale Value
213 Gaurav
Query2
4,000
Incorrect result
Id Sales
C Name
213 Gaurav
Sale Value
8,000
Item Value
4,000
C Name
Id Sales
Gaurav
213 Accessories
1,000
4,000
Gaurav
213 car
3,000
4,000
Observe that when we added Item Type to get the detail , item value is properly displayed but
sale value still shows two rows with same value and hence when we remove the item_type, it
gets aggregated and show 8000, which is a wrong value.
How to resolve this: Again like Chasm trap you have to create two separate queries to display
correct result.
1. Create 2 sql statements by checking the option of Multiple sql statements for each measure
2. Create alias and context.
3. Use aggregate awareness to avoid this scenario.
1. Setting the option in universe parameter:
This will generate 2 sql statements, if measures are selected from 2nd and 3rd table.
C Name
Gaurav
Item Value
Sale Value
4,000
4,000
This gives correct results. But will not work in case you are selecting only dimension objects and
not measure.
Join Customer with alias table and set cardinalities of the same.
Now we will create two context lets say C1 and C2 like below.
Now we have to take the measure object from sales table i.e. sale_value from the aliased table
rather than sales, so repoint the sales value object to point to sale_value column of sales2
table.
Now, if you use the measure objects from two different context in one query, it will generate
multiple sql statements and the results will be correct.
C Name
Gaurav
Sale Value
4,000
Item Value
4,000
Note: There is another scenario also where this kind of trap can be created.
Lets say for example, in our structure of universe:
Now If have objects like C_id(dimension Object) , Sale_value(measure) from sales table and
item_value from sales_detail table in webi rich client query, it will again create a trap and will
show inflated results.
C Id
Sale Value
102
8,000
Item Value
4,000
So its showing inflated results again i.e. wrong value of sale value.
To resolve this, we will create alias of sales table, same as above case.
What is an object?
In Business Objects products an object is a named component in a universe that represents a
column or function in a database.
Groupings or categories of objects within a universe are called classes. The primary function of
classes is to provide structure to the layout of universe. Typically, the general strategy is to
group related dimension and detail fields into a class and place measure objects into a different
class. This strategy can be extended through introducing sub-classes to break down objects into
more granular subsets.
Three categories of classes exist
Dimension Classes: Objects which are shared across transaction types to describe the
transaction and provide summarization levels.
Measure Classes: Primary reporting objects for displaying numeric results (also known as
facts).
Application Classes: Objects that support the reporting application, including customized lists
of values, prompts, and condition objects.
Subclasses:
A subclass is a class within a class. You can use subclasses to help organize groups of objects
that are related. A subclass can itself contain other subclasses or objects.
Drill UP Drill up the levels from Low level detailed data to high level summarized data.
2.
Drill Down Drill down the levels from high level summarized data to Low level detailed
data.
3.
Drill By Drill By is an advanced drill feature that is also listed in the speed menu with Drill
Up and Drill Down. It allows you to skip over objects in the current hierarchy or to jump to a
different hierarchy for additional analysis.
2. Custom Hierarchies:
Business Objects allows creating logical hierarchies using custom hierarchy. In custom
hierarchy the sequence of dimensions is defined by developer based on business need of
analysis.
End user might want to drill down the revenue generated based on employee designation. You
can define the sequence of dimensions based on business need.
Creating Custom Hierarchies:
1. Click on Tools->Hierarchies
2. Hierarchies editor will show default hierarchies
If two or more hierarchies starts with same dimensions but follow different dimensions at lower
end and if user performs drill-down on dimensions from such hierarchy then Web Intelligence
asks user to select the drill path.
e.g. If we create two custom hierarchy which starts with Year but follow different path.
Then it asks user to select the drill path as there two drill path defined from Year.
List of values or LOV is a distinct list of data values associated with an object. When any
dimension of details object is created LOV is assigned to an object automatically.
A LOV is
When first LOV is created it is stored in .LOV file name at universe subfolder on the system file
system.The default location is
C:\Documents and Settings\<UserName>\Application Data\Business Objects\Business Objects
12.0\Universes\@<ServerName>\<UniverseName>
LOV Options
List Name
Its the name of LOV file by which it will stored on local file system. User can override the default
name and can enter his own LOV name. Maximum character limit is 8.
Allow Users to Edit List of Values
When checked this option allows report users to edit the list of values of an objects. The
purpose of a list of values is usually to limit the set of available values to a user. If they can edit
a list, you no longer have control over the values they choose. Normally, if you are not using a
personal data file as a list of values source, you clear this option to ensure that users do not edit
lists of values.
Automatic Refresh before Use
When selected this option LOV will be refreshed each times it is referred and used in report.
You should choose this option only if contents of underlying column are frequently changing.
These options should be use very carefully after evaluation. If this option is not selected LOV is
refreshed first when the objects is used in a user session.
Hierarchical Display
Select the Hierarchical Display property to display the cascading list of values as a hierarchy in
Web Intelligence.
Export with Universe
When this option is selected LOV file associated with object is exported to universe CMS and
gets stored as XML on CMS
Viewing the LOV of an object
To view the LOV of an objects click on display button on properties tab of an object
1. In addition to query you can also define LOV for an object using personal data file like CSV and
values from this file can also be used as LOV for an object. To do so.
2. Click on Personal Data and provide the details on Personal data LOV dialog box.
Cascading LOV:
Cascading LOV is a LOV associated with hierarchy of an object in the universe. Cascading LOV
is created, and if any of the objects is used as prompt filter in report query, user has to answer
series of values from cascading LOV.
How to create Cascading LOV
1. Click on Tools->List of Values->Create Cascading LOV.
Linking universes
Linked universes are universes that share common components such as parameters, classes,
objects, Or joins. When you link two universes, one universe has the role of a core universe, the
other a derived universe. When changes are made in core universe, they are automatically
propagated to the derived universes.
What is a core universe?
The core universe is a universe to which other universes are linked. It contains components that
are common to the other universes linking to it. These universes are called derived universes.
The core universe represents a re-usable library of components. A core universe can be a
kernel or master universe depending on the way the core universe components are used in the
derived universes.
Both the universes (core and derived) must use same connection and should connect to
same database.
Only one level of linking is allowed you can create derived universe from another derived
universe.
Both universes should have unique object and classes. If there are duplicate
objects/classes it will be renamed in core universe.
Tables from two universes must be joined after linking in order to avoid Cartesian product.
When core universe is linked in derived universe only classes, objects and tables are made
available in derived universe. Context and LOV needs to be recreated in derived universe.
Click OK
After this components from core universe will be available in derived universe and it will be
grayed.
Now analyze the derived universe and create joins between tables added from core
universe.
Lets see what this aggregate awareness functionality is and how it is useful in universe.
Lets say I have two tables customer and daily fact with below data:
If I create the report of customers daily sales, it will join customer and daily fact table using cid
column and will give me 24 rows of data.
But if my requirement is to create only quarterly sales or just monthly sales than the data will still
traverse through 24 rows of daily fact table.
For eg. Monthly sales will give me 12 rows of data while quarterly will be 4 rows of data. But
this is still getting data from detail fact which has 24 rows, which if hold million facts can slow
down the performance.
So we create materialized views or summary tables in our database for better performance.
And I created monthly and quarterly fact in my sample database. Below are the aggregated
tables that I can use in my universe.
Now, the question is, we have aggregate tables but how to use the same in my universe based
on user queries dynamically. Aggregate awareness functionality will help me in achieving the
same. It is a two-step process:
1
Use aggregate aware function in objects that needs to be made aggregate aware.
Now, I have made time dimensions i.e. Sales Dt, Sales Month and Sales Qtr and measue Sales
as aggregate aware.
Aggregate function has syntax like:
@Aggregate_Aware(sum(aggregate table1),...,sum(aggregate tableN)) Defines a measure
object using precalculated aggregate tables.
Where table1 is highly aggregated (in our case quarterly fact),........and tableN is the least
aggregate or detailed one(in our case daily fact)
If you observe the definition in the select statement of Sales measure here, it is from highly
aggregated table to detail one , same is done for the dimension table as well.
Now month is present in only two tables, hence only monthly and daily fact is used.
Sales Qtr object, quarter is present in all three fact tables; hence all the three are used.
We have used aggregate function in these tables, so we hope that system automatically will
decide which table to refer dynamically, when a user selects or tries to run a query.
That means if user wants daily data than daily fact should be used, if monthly than monthly fact
or if quarterly sales than quarterly fact.
Now, we have to set the incompatibilities.
This is done from Aggregate Navigation section under tools, in menu bar.
We have to make objects incompatible to tables.
For eg. Sales dt is incompatible to quarter and months table, similarly Sales month object is
incompatible to quarter table.
You have to click the table and check the box in front of object to make it incompatible with the
selected table.
Lets see how the queries behave, when you select different set of objects:
Scenario 1:
I selected customer name and sales, and if you see the below query , it is behaving same as the
one i expect it, as it is taking data from quarterly fact table.
Scenario 2: I added sales month object to it, and will remove quarter object.(it should only now
point to monthly facts)
The @prompt function asks the end user to enter any specific values. Prompt functions are
generally used in where clause of an object to build interactive filter condition in the report.
@Prompt(message,type,[lov],mono/multi,free/constrained/primary_key,persistent/not_
persistent, [{default value:default key'[,default value:defaultkey,]})
Message: Is the text which would be prompted to user. It should be included in single quotes.
Type: Data type to be returned by function. It can be any one of following.
A: Alphanumeric
N: Number
D: Date
LOV: List of values which would be displayed to end user to choose from. LOV could be
hardcode or you can use LOV of an existing object.
e.g. {A,B} or Country\Name
Mono: User can select only one value from list
Multi: user can select multiple values from list
Free: User can select or enter value.
Constrained: User ,ust select value from the list.
The Visual Basics for applications macros results will be recovered by using @Script
function. @Script(var_name, vartype, script_name)
An existing statements SELECT statement can be re-used by using @Select function.
Syntax: @Select(Classname\Objectname)
The @Variable function is used to call the value assigned to variables. This function is
generally used in security implementation. You can more information on this function
on business objects user guide.
e.g. You variable (BOUSER) will return the name of currently logged in business
objects user
An existing objects where clause can be re-used by @Where functions.
Syntax: @Where(Classname\Objectname)