Sie sind auf Seite 1von 232

BusinessObjects XI 3.0/3.

1: Advanced Universe Design

Learners Guide BOU320

Copyright

2009 SAP BusinessObjects. All rights reserved. SAP BusinessObjects owns the following United States patents, which may cover products that are offered and licensed by SAP BusinessObjects and/or affliated companies: 5,295,243; 5,339,390; 5,555,403; 5,590,250; 5,619,632; 5,632,009; 5,857,205; 5,880,742; 5,883,635; 6,085,202; 6,108,698; 6,247,008; 6,289,352; 6,300,957; 6,377,259; 6,490,593; 6,578,027; 6,581,068; 6,628,312; 6,654,761; 6,768,986; 6,772,409; 6,831,668; 6,882,998; 6,892,189; 6,901,555; 7,089,238; 7,107,266; 7,139,766; 7,178,099; 7,181,435; 7,181,440; 7,194,465; 7,222,130; 7,299,419; 7,320,122 and 7,356,779. SAP BusinessObjects and its logos, BusinessObjects, Crystal Reports, Rapid Mart, Data Insight, Desktop Intelligence, Rapid Marts, Watchlist Security, Web Intelligence, and Xcelsius are trademarks or registered trademarks of Business Objects, an SAP company and/or affiliated companies in the United States and/or other countries. SAP is a registered trademark of SAP AG in Germany and/or other countries. All other names mentioned herein may be trademarks of their respective owners.

C O N T E N T S
About this Course
Course introduction.....................................................................................................xi Course description......................................................................................................xii Course audience..........................................................................................................xii Prerequisites.................................................................................................................xii Level, delivery, and duration....................................................................................xii Applicable certifications and designations..............................................................xii Course success factors...............................................................................................xiii Course setup...............................................................................................................xiii Course materials.........................................................................................................xiii Learning process.........................................................................................................xiii

Lesson 1

Reviewing Universe Design Concepts


Lesson introduction.......................................................................................................1 Using your BusinessObjects Universe Designer knowledge..................................2 Review: Using universe design concepts............................................................2 Activity: Implementing a universe......................................................................3 Reviewing the course database and universe............................................................6 The course database...............................................................................................6 An overview of the Motors universe...................................................................6 Activity: To deploy the Motors universe (Optional).........................................7 Lesson summary............................................................................................................9

Lesson 2

Working with Aggregate Awareness


Lesson introduction.....................................................................................................11 Defining aggregate awareness...................................................................................12 What is aggregate awareness?............................................................................12 Summary tables....................................................................................................12 Summary tables and SQL ...................................................................................13 Applying aggregate awareness.................................................................................15 Setting up aggregate awareness.........................................................................15 Redefine the objects .............................................................................................16 Applying aggregate awareness to objects........................................................16 Define incompatible objects................................................................................17

Table of ContentsLearners Guide

iii

Activity: Setting up aggregate awareness - part 1...........................................20 Activity: Setting up aggregate awareness - part 2...........................................22 Using aggregate awareness to resolve fan traps..............................................23 Outer joins and aggregate awareness...............................................................25 Quiz: Working with aggregate awareness...............................................................28 Lesson summary..........................................................................................................29

Lesson 3

Designing Advanced Objects


Lesson introduction.....................................................................................................31 Combining database functions in objects.................................................................32 Using database functions in objects...................................................................32 Activity: Combining database functions in objects ........................................36 Working with analytic functions.......................................................................38 What are analytic functions?..............................................................................38 Constructing relative date-time objects....................................................................41 Date functions in objects.....................................................................................41 Relative date-time objects ..................................................................................43 CASE statements in measure objects ................................................................44 Activity: Constructing relative date-time objects ...........................................46 Moving averages..................................................................................................50 Activity: Creating a moving average.................................................................53 Quiz: Designing advanced objects............................................................................57 Lesson summary..........................................................................................................58

Lesson 4

Creating Complex Predefined Conditions, LOVs, and Joins


Lesson introduction.....................................................................................................59 Creating complex predefined conditions.................................................................60 Subqueries in predefined conditions.................................................................60 Activity: Creating subqueries in predefined conditions................................62 @Prompt scenarios in predefined conditions...................................................64 Activity: Using @prompt in predefined conditions........................................66 Working with advanced LOVs..................................................................................68 Customizing LOVs...............................................................................................68 Activity: Modifying LOVs..................................................................................69 Arranging LOV data as an A-Z index...............................................................71 Activity: Arranging LOVs...................................................................................73 Working with advanced join syntaxes......................................................................74 Defining @prompt functions in a join...............................................................74 Defining conditional join paths..........................................................................75 Using joins to construct relative date-time objects..........................................76

iv

Advanced Universe DesignLearners Guide

Conditional joins and running calculations.....................................................78 Activity: Using complex joins.............................................................................80 Quiz: Creating complex predefined conditions and LOVs...................................84 Lesson summary..........................................................................................................85

Lesson 5

Securing Universes
Lesson introduction.....................................................................................................87 Defining connection and user credential parameters.............................................88 About security and universes ............................................................................88 User credentials for the connection ..................................................................88 Working with Central Management Server (CMS) universe security.................90 Organizing universes in secured folder structures ........................................90 Working with table mapping in restriction sets......................................................92 About restriction sets...........................................................................................92 Working with table mapping.............................................................................93 Activity: Working with table mapping in a restriction set.............................96 Quiz: Securing universes............................................................................................99 Lesson summary........................................................................................................100

Lesson 6

Implementing Universe Life Cycle Management


Lesson introduction...................................................................................................101 Moving content from development to production...............................................102 Life cycle management......................................................................................102 Using the Import Wizard..................................................................................103 Universes and universe connections...............................................................107 Working with Business Intelligence Archive Resource (BIAR) files .........108 Using test folders................................................................................................112 Life cycle management recommendations.....................................................113 Activity: Moving content from development to production.......................114 Quiz: Implementing universe life cycle management..........................................116 Lesson summary........................................................................................................117

Lesson 7

Maintaining and Optimizing Universes


Lesson introduction...................................................................................................119 Optimizing universes................................................................................................120 The Connection Server......................................................................................120 Setting up a trace file.........................................................................................121 Connection configuration parameters.............................................................122 Custom connection parameters........................................................................124

Table of ContentsLearners Guide

Dynamic SQL parameters.................................................................................126 Adapting dynamic SQL parameters................................................................127 BEGIN_SQL........................................................................................................127 END_SQL............................................................................................................127 ANSI92 and FILTER_IN_FROM .....................................................................128 About ANSI92 SQL syntax ..............................................................................129 The ANSI92 dynamic SQL parameter.............................................................130 Applying the FILTER_IN_FROM functionality to individual classes and objects...................................................................................................................131 The JOIN_BY_SQL parameter..........................................................................135 Activity: Using dynamic SQL parameters......................................................136 Applying index awareness ......................................................................................139 What is index awareness? ................................................................................139 Avoiding joins in tables.....................................................................................140 Multiple foreign key entries.............................................................................141 SQL Editor dialog box ......................................................................................143 Using an index awareness WHERE clause.....................................................143 Applying best practices for universe design.........................................................144 Best practices for designing and optimizing your universe........................144 Quiz: Maintaining and optimizing universes........................................................147 Lesson summary........................................................................................................148

Lesson 8

Creating Universes from Other Data Sources


Lesson introduction...................................................................................................149 Creating a universe from an XML data source......................................................150 Which data sources are supported in the Metadata Exchange panel?.......150 Working with the Metadata Exchange panel.................................................150 Creating stored procedure and JavaBeans universes...........................................155 Stored procedure universes..............................................................................155 Creating a universe based on stored procedures..........................................155 Stored procedure parameters in the universe................................................156 Advantages and disadvantages of stored procedure universes.................157 JavaBeans and universes...................................................................................158 Activity: Creating stored procedure universes .............................................160 Working with OLAP universes...............................................................................162 Understanding the OLAP cube........................................................................162 Generating universes from OLAP cube sources............................................164 Modifying and updating an OLAP universe.................................................165 Activity: Creating an OLAP universe.............................................................168 Quiz: Creating universes from other data sources...............................................169 Lesson summary........................................................................................................170

vi

Advanced Universe DesignLearners Guide

Appendix A

End of Course Challenge


Activity: Completing the end of course challenge................................................171

Appendix B

Data Access Files


BusinessObjects data access files.............................................................................175 The PRM file...............................................................................................................181

Appendix C

External Strategies
Using external strategies in Universe Designer....................................................185 Types of strategies.....................................................................................................187

Appendix D

SQL syntaxes for other RDBMS


Alternative SQL syntaxes for other RDBMS..........................................................189 ORACLE......................................................................................................................190 MySQL.........................................................................................................................194 DB2...............................................................................................................................197

Answer Key
Review: Using universe design concepts...............................................................203 Quiz: Working with aggregate awareness.............................................................207 Quiz: Designing advanced objects..........................................................................208 Quiz: Creating complex predefined conditions and LOVs.................................209 Quiz: Securing universes..........................................................................................210 Quiz: Implementing universe life cycle management..........................................211 Quiz: Maintaining and optimizing universes........................................................212 Quiz: Creating universes from other data sources...............................................213

Table of ContentsLearners Guide

vii

viii

Advanced Universe DesignLearners Guide

Advanced Universe Design


Introductions, Course Overview...........................................30 minutes
Lesson 1

Reviewing Universe Design Concepts........................................1 hour


Using your BusinessObjects Universe Designer knowledge Lesson 2

Working with Aggregate Awareness..........................................2 hours


Defining aggregate awareness Applying aggregate awareness Lesson 3

Designing Advanced Objects.................................................2.25 hours


Combining database functions in objects Constructing relative date-time objects Lesson 4

Creating Complex Predefined Conditions, LOVs, and Joins.....................................................................................................2 hours


Creating complex predefined conditions Working with advanced LOVs Working with advanced join syntaxes Lesson 5

Securing Universes...................................................................45 minutes


Defining connection and user credential parameters Working with Central Management Server (CMS) universe security Lesson 6

Implementing Universe Life Cycle Management.............45 minutes


Moving content from development to production

AgendaLearners Guide

ix

Lesson 7

Maintaining and Optimizing Universes.....................................2 hours


Optimizing universes Applying best practices for universe design Lesson 8

Creating Universes from Other Data Sources..................1.75 hours


Creating a universe from an XML data source Creating stored procedure and JavaBeans universes Working with OLAP universes

Advanced Universe DesignLearners Guide

About this Course


Course introduction
This section explains the conventions used in the course and in this training guide.

About this CourseLearners Guide

xi

Course description
This two-day instructor-led advanced course is designed to give you the comprehensive skills and in-depth knowledge needed to design universes in BusinessObjects Universe Designer. The business benefit of this course is that you will learn best-practice methodology for creating universes that respond to your reporting requirements. Through well-designed universes, report designers and business users will be able to create reports without having to know anything about the underlying data source or structure.

Course audience
The target audience for this course is anyone responsible for creating and designing universes using Universe Designer, using BusinessObjects XI 3.0/3.1. The learners who attend the course will be most successful if they have experience in working with Business Objects Universe Designer. New features covered in the XI 3.0/3.1 course that are not applicable to BusinessObjects XI R1/R2 learners include: Creating universes from stored procedures and JavaBeans Creating, modifying, and updating universes from OLAP data sources using the enhanced OLAP functionality in Universe Designer

Prerequisites
To be successful, learners who attend this course should have attended the following offerings: BusinessObjects XI R2: Universe Design, and/or BusinessObjects XI 3.0/3.1: Universe Design BusinessObjects Web Intelligence XI R2: Report Design, and/or BusinessObjects Web Intelligence XI 3.0/3.1: Report Design To be successful, you must be familiar with: The metadata and logical structure of the databases in your organization BusinessObjects Web Intelligence report building Using BusinessObjects Universe Designer Using and working with SQL and relational database management systems concepts and structures The BusinessObjects Central Management Console

Level, delivery, and duration


This advanced instructor-led offering is a two-day course.

Applicable certifications and designations


This course is not applicable to any Business Objects Certified Professional programs.

xii

Advanced Universe DesignLearners Guide

Course success factors


Your learning experience will be enhanced by: Activities that build on the life experiences of the learner Discussion that connects the training to real working environments Learners and instructor working as a team Active participation by all learners

Course setup
Refer to the setup guide for details on hardware, software, and course-specific requirements.

Course materials
The materials included with the course materials are: Name card Learners Guide The Learners Guide contains an agenda, learner materials, and practice activities. The Learners Guide is designed to assist students who attend the classroom-based course and outlines what learners can expect to achieve by participating in this course. Evaluation form At the conclusion of this course, you will receive an electronic feedback form as part of our evaluation process. Provide feedback on the course content, instructor, and facility. Your comments will assist us to improve future courses. Additional resources include: Sample files The sample files can include required files for the course activities and/or supplemental content to the training guide. Online Help Retrieve information and find answers to questions using the online Help and/or users guide that are included with the product.

Learning process
Learning is an interactive process between the learners and the instructor. By facilitating a cooperative environment, the instructor guides the learners through the learning framework.

Introduction
Why am I here? Whats in it for me? The learners will be clear about what they are getting out of each lesson.

About this CourseLearners Guide

xiii

Objectives
How do I achieve the outcome? The learners will assimilate new concepts and how to apply the ideas presented in the lesson. This step sets the groundwork for practice.

Practice
How do I do it? The learners will demonstrate their knowledge as well as their hands-on skills through the activities.

Review
How did I do? The learners will have an opportunity to review what they have learned during the lesson. Review reinforces why it is important to learn particular concepts or skills.

Summary
Where have I been and where am I going? The summary acts as a recap of the learning objectives and as a transition to the next section.

xiv

Advanced Universe DesignLearners Guide

Lesson 1

Reviewing Universe Design Concepts


Lesson introduction
During this lesson you review your existing universe design and BusinessObjects Universe Designer knowledge, and review key concepts from the BusinessObjects XI 3.0/3.1: Universe Design course. After completing this lesson, you will be able to: Use your universe design and BusinessObjects Universe Designer knowledge to solve business problems Describe the course universe, database data, and structure

Reviewing Universe Design ConceptsLearners Guide

Using your BusinessObjects Universe Designer knowledge


The interactive review in this lesson asks you to use your BusinessObjects Universe Designer knowledge and features you should be proficient in to complete this course. After completing this unit, you will be able to: Use current BusinessObjects Universe Designer skills to solve reporting business problems

Review: Using universe design concepts


Objective
Review your knowledge of Universe Designer

Instructions
1. What is a universe? 2. Does a universe store data? 3. What are the main advantages of a universe? 4. Describe the connection types and their purposes. 5. What are the types of objects that can be created in a universe? Provide a brief description of each type. 6. What are the different join types allowed in the universe structure. Provide a short description of each type. 7. What are the different types of SQL traps that can be found in a schema? How can each of these types be identified? How can each type be resolved in the universe schema? 8. What are loops and how can they be resolved? 9. Describe how you would test a measure to make sure the aggregation levels are projected correctly. 10.Explain two drawbacks of using restrictions at the object level. 11.Describe the use of the @select function. 12.What is a hierarchy? 13.Describe what a derived table is and how it is generally used in a universe schema. 14.Describe what index awareness is, and how it is used in a universe schema. 15.What are the pros and cons of delegated functionality in a universe-based reporting structure?

Advanced Universe DesignLearners Guide

Activity: Implementing a universe


Objective
Implement a universe using Universe Designer

Instructions
The project team is asked to design a universe solution for the Island Resorts Company. The project team made the following findings during the preparation, analysis, and planning phases, and are now preparing for the implementation stage. The Island Resorts Company requires an ad-hoc reporting system for their resort locations. There are five holiday destinations; Royal Caribbean, Hawaiian Club, French Riviera, Bahamas Beach, and Australian Reef. Standards Customers and clients are referred to as guests. Database design specifics The database has six years of data: 2004 - 2006 for current bookings, 2007 - 2009 for reservations. Objects and filters Condition objects are required for the three years of guests, the three years for reservations, the location, guests under the age of 30, and guests from the US. Dates are to be reported on as year, quarter, month, week, and invoice or reservation date. Measures are for future guests, current guests, and also for revenue. Customer information for reporting is hierarchical, and should include the customer's age group. Some personal details of customers are also required for reporting. 1. Start a Universe Designer session and log on using the credentials provided by the instructor. 2. Create a new blank universe called TravelClub _xx, where "xx" stands for your initials. 3. Create a new OLE DB connection called ClubOLEDB_xx, where "xx" stands for your initials. a. Select File Parameters Definition, and then click New below the Connection field. b. Click Next. c. Select Secured from the Connection Type drop-down list. d. In the Connection Name field, type ClubOLEDB_xx, where "xx" stands for your initials. e. Expand the Microsoft node, which is the target database for the connection. f. Expand the MS SQL Server 2005 node, which is the target middleware for the connection. g. Select the OLE DB Providers driver name and click Next. h. Select Use specified username and password as the authentication mode. i. In the User name and Password fields enter the database login credentials. Use the SQL Server database server credentials, as provided to you by the instructor.

Reviewing Universe Design ConceptsLearners Guide

j. In the Server field, select or enter the appropriate SQL Server name to connect to, as provided to you by the instructor. k. In the Database field, enter Club, the name of the database you are connecting to. l. Click Next twice, and click Finish. m. In the Wizard Connection dialog box, click Test to test the connection. If the connection is valid, a message dialog box appears, indicating that the connection is correct. If you receive an error message, check that you entered all the parameters correctly. n. Click Finish to exit the wizard. 4. Insert the tables outlined in the diagram:

5. Create classes to hold objects for measures, reservations, customers, sales, and resorts. Most objects are dimensions, except for those in the measures class. The use of details is for personal information on the client only. 6. Check for chasm traps, fan traps, and loops, and resolve them accordingly. 7. Save your universe locally. 8. Test your universe by building queries in Web Intelligence Rich Client. a. Launch Web Intelligence Rich Client. Go to Start Programs BusinessObjects XI 3.0/3.1 BusinessObjects Enterprise Web Intelligence Rich Client. b. Log on using the credentials provided by the instructor. c. Select the create a new document based on a data source icon. d. Select Browse for more data sources. e. Select Universe, and click Next. f. Select your TravelClub universe, and click OK.

Advanced Universe DesignLearners Guide

g. Build a new query using the objects you have created. Drag and drop the objects into the Result Objects pane. h. Click Run Query to view the final results displayed in the report. 9. Run appropriate reports in Web Intelligence Rich Client to: Identify number of guests who have stayed by time period as well as by country of origin. Identify number of guests by each location, listing the services. Determine the revenue generated by time period. Identify whether customers are from the US or whether they are under the age of 30. A requirement exists to identify Americans who are under the age of 30 separately from other guests. Identify the different services available at each location. The services could be accommodation, amenities, or activities. Report on the number of guests by age group for the time period 2004 to 2006. Report on the number of guests by age group for the time period 2007 to 2009.

Reviewing Universe Design ConceptsLearners Guide

Reviewing the course database and universe


In order to create a BusinessObjects universe, you must first be familiar with the data and structure of the database to which the universe is connected. The universe used for this course has been created in the BusinessObjects XI 3.0/3.1: Universe Design course, and is further extended during this advanced course. After completing this unit, you will be able to: Understand the database and universe used during this course

The course database


Two universes have been created during the BusinessObjects XI 3.0/3.1: Universe Design course, Motors and Staff, that report on a database for a fictional car sales and rentals organization called Prestige Motors. The database has the following characteristics: There are three showrooms, two in the US and one in the UK. Each showroom has the franchise for a number of different car makers, who all manufacture a number of different models, available in a range of colors. Customers may either rent or buy cars. Customers usually rent or buy from the showroom in their own country but this is not always the case. The database contains data for two financial years 2003/2004 and 2004/2005. Each year begins on April 6 and ends on April 5 in the subsequent year. Information about employees who work within the organization is also available in the database. There are summary tables for quarterly and annual revenue and numbers to speed up queries. The data is stored in a SQL Server 2005 database. Connections to the database are to be made using OLE DB.

Assumptions
There has been no inflation over the different years for which data is held. There is no stock data. All manufacturers are able to supply on demand. Users in all countries use the same currency (the US dollar). No new models have been brought out during the period.

An overview of the Motors universe


The Motors universe was created during the BusinessObjects XI 3.0/3.1: Universe Design course, and the final version of the Motors universe from the core course, is further extended during this advanced course.

Advanced Universe DesignLearners Guide

In the BusinessObjects XI 3.0/3.1: Universe Design course, the MotorsOLEDB connection was created to connect to the Motors SQL Server 2005 database. The Motors universe file was initially populated only with sales data, and further extended to rental data later on in the course. The rental data was brought in based on a sale alias table. Adding the rental data created loops in the schema that were resolved using contexts and aliases. Dimension and measure objects were created for sales and rental reporting needs. Hierarchies were established to allow end user to drill in reports. To cross reference objects, @functions were used to reuse existing objects, and avoid creating the same object requirements in the universe. Condition objects and restrictions sets were defined to restrict data returned in reports, and to add security to the universe. Primary key indexes were applied and some derived tables were introduced into the universe structure. A Staff universe was developed to comply with reporting needs to report on employee and manager data. To merge the staff and motors data into one universe schema, the Motors and Staff universes were linked. The dynamic link was broken to embed the Staff data into the Motors universe structure.

Activity: To deploy the Motors universe (Optional)


Objective
Deploy the Motors universe

Reviewing Universe Design ConceptsLearners Guide

Instructions
The Motors universe is built throughout the BusinessObjects XI 3.0/3.1: Universe Design course. This course builds on the final universe file from the BusinessObjects XI 3.0/3.1: Universe Design course. If this course is taught separate from the core Universe Design course, the final version of the BusinessObjects XI 3.0/3.1: Universe Design course needs to be deployed using the steps outlined in this activity. 1. In Universe Designer, open the Motors universe file provided in the Activity_Resources Motors_start folder in the course resources. 2. Rename the universe to Motors_xx, where "xx" stands for your initials. 3. Create a new OLE DB connection called MotorsOLEDB_xx, where "xx" stands for your initials. a. Select File Parameters Definition, and then click New below the Connection field. b. Click Next. c. Select Secured from the Connection Type drop-down list. d. In the Connection Name field, type MotorsOLEDB_xx, where "xx" stands for your initials. e. Expand the Microsoft node, which is the target database for the connection. f. Expand the MS SQL Server 2005 node, which is the target middleware for the connection. g. Select the OLE DB Providers driver name and click Next. h. Select Use specified username and password as the authentication mode. i. In the User name and Password fields enter the database login credentials. Use the SQL Server database server credentials, as provided to you by the instructor. j. In the Server field, select or enter the appropriate SQL Server name to connect to, as provided to you by the instructor. k. In the Database field, enter Motors, which is the name of the database you are connecting to. l. Click Next twice, and click Finish. m. In the Wizard Connection dialog box, click Test to test the connection. If the connection is valid, a message dialog box appears indicating that the connection is correct. If you receive an error message, check that you entered all the parameters correctly. n. Click Finish to exit the wizard. 4. Select File Save As to save your Motors universe version locally.

Advanced Universe DesignLearners Guide

Lesson summary
After completing this lesson, you are now able to: Use your universe design and BusinessObjects Universe Designer knowledge to solve business problems Describe the course universe, database data, and structure

Reviewing Universe Design ConceptsLearners Guide

10

Advanced Universe DesignLearners Guide

Lesson 2

Working with Aggregate Awareness


Lesson introduction
This lesson describes how you can use features in Universe Designer to define an objects SELECT statement so that you can run a query against aggregate tables in the database instead of against the base tables. You can set conditions so that a query runs against aggregate tables if doing so optimizes the query. If this is not the case, the query runs against the base tables. This ability of an object to use aggregate tables to optimize a query is called aggregate awareness. After completing this lesson, you will be able to: Define aggregate awareness Apply aggregate awareness to objects

Working with Aggregate AwarenessLearners Guide

11

Defining aggregate awareness


Aggregate awareness is a term that describes the ability of a universe to make use of aggregate tables in a database. Using aggregate tables speeds up the execution of queries, improving the performance of SQL transactions. The reliability and usefulness of aggregate awareness in a universe depends on the accuracy of the aggregate tables. They must be refreshed at the same time as all fact tables. After completing this unit, you will be able to: Understand what is meant by the term aggregate aware Understand why universes that are aggregate aware allow queries to process more efficiently

What is aggregate awareness?


Some databases contain summary tables. These tables are created by the Database Administrator (DBA) and contain figures such as revenue aggregated to a high level (year, for example) rather than to the fact/event level. The summary tables are usually populated and updated regularly by an automated program that runs SQL against the fact or event data at transaction level. This means that there are two methods that you can use to return aggregated data: Run a SELECT statement for the fact or event data. Run a SELECT statement for the summary data. Where possible, it is best to choose the latter method as the statement processes quicker. In Universe Designer, you can use a function called @aggregate_aware in the SELECT statement for an object, so that both methods are referenced. This function directs a query to run against aggregate tables whenever possible. If the data in the aggregate table is not calculated at the level of granularity required to run the query, the object directs the query to run against the tables containing the non-aggregated data. A universe that has one or more objects with alternative definitions based on aggregate tables is said to be aggregate aware. These definitions correspond to levels of aggregation. For example, an object called Profit can be aggregated by month, by quarter, or by year. The reliability and usefulness of aggregate awareness in a universe depends on the accuracy of the aggregate tables. They must be refreshed at the same time as all fact tables.

Summary tables
Each row in a summary table is made up of columns containing: Aggregated data: Numeric event data aggregated to a higher level. In the example table image, columns containing aggregated data are Annual_Sale_Value, Annual_Sale_Cost, Annual_Sale_Number, Annual_Rent_Value, and Annual_Rent_Number. Dimension data: Attributes defining the level of the aggregated data.

12

Advanced Universe DesignLearners Guide

In this example, there is only one column containing dimension data: FP_Year. Foreign keys (optional): Joins to other tables. If these exist, queries can be made using summary table aggregated data on the basis of dimension objects held in other tables of the database, as opposed to just those contained within the summary table itself.

Within Business Objects end-user querying tools, columns containing aggregated and dimension data are incorporated into objects using the @function called @aggregate_aware. Foreign keys are used to set joins in the structure of the universe. Note: Aggregate awareness works on all tables, not just fact tables. It can also be applied to all object types with all data types, not just numbers and measures.

Summary tables and SQL


Where possible, it is prudent to use summary table data because the processing required to return the aggregated data is far quicker.

You can see in the example diagram that making a query based on event data at a transaction level requires a more complex SELECT statement and the processing of more database rows than one based on summary data. Aggregates of a normalized database are based on event/fact level data:

Working with Aggregate AwarenessLearners Guide

13

Summary tables can be added to a database that hold data at a higher level of aggregate:

Making use of summary table data speeds up response times because: There are fewer rows to process. Fewer, if any, joins are required.

14

Advanced Universe DesignLearners Guide

Applying aggregate awareness


The first step in setting up aggregate awareness in a universe is to determine which objects are to be aggregate aware. You can use either measure objects or dimension objects. After completing this unit, you will be able to: Set up aggregate aware objects Use aggregate awareness to resolve fan traps Use aggregate awareness to resolve outer join errors Test aggregate awareness in the universe

Setting up aggregate awareness


Applying aggregate awareness to objects in a BusinessObjects universe involves a four-step procedure: Step 1: Insert one or more summary tables in the universe structure. Set joins and cardinality. Step 2: Set the contexts. Step 3: Redefine the objects using @aggregate_aware. Step 4: Define incompatible objects using Aggregate Navigation. Note: Part of step 1 (setting joins and cardinality) and step 2 are not required if the summary table does not contain foreign keys.

To insert a summary table


Step 1 of the aggregate awareness process is to insert one or more summary tables to the universe structure. The procedure for inserting a summary table in the structure of the universe is the same as for any other table or view. 1. Insert the required summary table(s) in the structure using the Table Browser. 2. Position the table where it is convenient for the joins you need to make. 3. Add joins from the summary table to the existing structure. You need to examine the foreign keys in the summary table to see where the summary table can be joined to the universe. 4. Set cardinality for the new joins.

To detect contexts
Step 2 of the aggregate awareness process is to detect contexts.

Working with Aggregate AwarenessLearners Guide

15

After you add the summary table, several new loops may exist. You need to resolve these using contexts. 1. Click Detect Contexts on the toolbar. 2. Accept the new contexts and rename them if required.

Redefine the objects


The columns in the summary table containing aggregated and dimension data can be used to define object SELECT properties. In our example, the summary table columns can be used in the SELECT properties of the following objects: Sales Revenue Rental Revenue Number of Cars Sold Cost of Cars Sold Financial Year When you have added the summary table, each of these objects has two possible sources for returning data: A SELECT statement consisting of Table_Name.Column_Name from the summary table. Specify which of these methods to use when a query is run using these objects. You do this by modifying the SELECT properties for the affected objects using the @aggregate_aware function. This represents step 3 in the aggregate awareness process. The original SELECT statement in the existing object. Note: After redefining, remember to parse the objects.

Applying aggregate awareness to objects


Before editing any objects, confirm exactly what levels of aggregation are available. In our example, we have the basic aggregation calculation and the precalculated annual data from the summary table. If you also have summary tables for quarterly figures and monthly figures, you would have four possible levels altogether. When you apply the @aggregate_aware function, be aware of the available levels, and be clear about the descending order of aggregation, for example, Annual Figures, Quarterly Figures, Monthly Figures, and basic aggregation calculation.

The syntax of the @aggregate_aware function


@aggregate_aware(<SELECT statement for highest agg level>, <SELECT statement for second highest agg level>, .. <SELECT statement for second lowest agg level>, <original SELECT statement for basic agg calculation>)

16

Advanced Universe DesignLearners Guide

Each aggregation level SELECT statement is separated by a comma, and the entire expression is enclosed in brackets. The final SELECT statement must be valid for all queries. The @aggregate_aware function is directing the query engine to use the sum of the measure value taken from the summary table where possible and, where not possible, to use the next segment in the SELECT statement. The last segment in the @aggregate_aware function is always the original SELECT that does not use the summary tables. For example:
@aggregate_aware(sum(ANNUAL_FIGURES.ANNUAL_SALE_COST), sum(SALE_MODEL.SALE_QTY*MODEL.MODEL_COST))

Similarly, for dimension objects in the summary tables, the @aggregate_aware function simply selects the column from the summary tables first (in descending order of aggregation), and then from the normal source. For example:
@aggregate_aware(ANNUAL_FIGURES.FP_YEAR, FINANCE_PERIOD.FP_YEAR)

When you have redefined all the objects, the next step is to set when Web Intelligence or Web Intelligence Rich Client can use the summary tables, by defining which dimension and measure objects are, or are not compatible with the summary tables.

To apply the @aggregate_aware function


1. Double-click the object whose properties you want to edit, or click Insert Object on the toolbar to create a new object. 2. Click >> of the Select field to open the Edit Select dialog box. The current SELECT properties for the object, if any, displays in the top panel of the dialog box. Note: It can make the structure of the SELECT statement clearer if you keep each level of the @aggregate_aware function on a separate line. 3. Click at the beginning of the existing statement, if necessary. 4. Double-click the @aggregate_aware function in the @functions list dialog box. 5. Insert the aggregate actions within the brackets of the @aggregate_aware function in order of highest to lowest level of aggregation data. Separate each action with a comma. 6. Parse the redefined objects. 7. Click OK to accept the SELECT statement. 8. Click OK to close the Edit Properties dialog box. 9. Repeat the process for all the appropriate objects.

Define incompatible objects


When all objects requiring @aggregate_aware are correctly set, the final step in the process is to define object compatibility with each table in the universe structure.

Working with Aggregate AwarenessLearners Guide

17

All objects that infer columns from tables in the same context as the summary table can automatically be deemed compatible with the summary table. However, a summary table that does not contain any foreign keys cannot be joined to other tables and cannot be part of a context. In that case, any query that contains objects from the summary table and from other tables produces a Cartesian product. Therefore, all objects based on columns from any other table are deemed incompatible. You set incompatible objects using the Aggregate Navigation tool.

The Aggregate Navigation automatic detection tool


To set incompatibilities, you can use an automatic detection tool available in the Aggregate Navigation dialog box. While the Detect Incompatibility tool checks for incompatible objects, it isnt restricted to the table that is selected. The Detect Incompatibility tool sets objects to be incompatible throughout the whole table structure. Therefore, there are some objects that are incompatible with objects in other tables. This could result in queries that would normally return valid results returning instead an Incompatible combination of objects error message or returning a Cartesian product. The automatic detection tool detects incompatibilities on every table in the universe, and therefore may stop some legitimate queries from working. It is therefore recommended that you check each of the incompatible settings manually using the Aggregate Navigation tool.

To use the Aggregate Navigation tool


1. Identify all objects that reference the summary table(s) and associated tables included in the new context(s). Right-click each table and choose View Associated Objects. 2. Check the SQL for each associated object. Check the SELECT, WHERE clauses, and check the tables selected in the List of Tables by clicking the Tables button. Identify any object that references a table not in the summary table context as incompatible. 3. Do the same for condition objects. Note: Any objects that have an @function in their SELECT or WHERE are not picked up by the View Associated Objects option, because Universe Designer detection tools cannot look inside the parenthesis of an @function. You must use your knowledge of the universe or refer to universe documentation to identify if any of these objects need to be made incompatible/compatible. It is better to leave an object incompatible if you are not sure. 4. Select Tools Aggregate Navigation.

18

Advanced Universe DesignLearners Guide

The Aggregate Navigation dialog box displays.

In the Aggregate Navigation dialog box you can set the objects and conditions identified in step 2 and 3 as incompatible or compatible. 5. Select the summary table in the Universe Tables pane. The right pane shows the list of classes and objects that need to be checked for compatibility for the summary table you selected. 6. Open each class in turn and select the check box adjacent to each object that is incompatible with the summary table and its context.

Working with Aggregate AwarenessLearners Guide

19

Use your familiarity with the universe to check that objects shown as compatible (that is, not checked) operate correctly and not produce Cartesian products or an incompatible combination of objects. 7. If an object is set incorrectly, clear the object by clicking it. 8. When you are satisfied with all incompatibility settings, click OK to close the Aggregate Navigation dialog box.

Activity: Setting up aggregate awareness - part 1


Objectives
Insert summary tables into your Motors universe Apply aggregate awareness

Instructions
Prestige Motors management is finding that the annual and quarterly reports take a long time to run. They have requested that these reports be produced without any noticeable processing delay. Insert the ANNUAL_FIGURES and QUARTER_FIGURES summary tables into your Motors universe and make the universe aggregate aware. Note: The steps in the activity represent some of the steps demonstrated by the instructor in the classroom. 1. In Universe Designer, open your Motors universe file. 2. Incorporate the ANNUAL_FIGURES summary table in your Motors universe and apply aggregate awareness as follows: a. Insert the ANNUAL_FIGURES table in the structure of the universe and insert the following joins and set cardinality.
SHOWROOM.SHOWROOM_ID = ANNUAL_FIGURES.SHOWROOM_ID (1:N) MAKER.MAKER_ID = ANNUAL_FIGURES.SHOWROOM_ID (1:N)

b. Detect contexts. Note: In this instance, the new joins and tables do not affect existing contexts. Do not delete or overwrite the existing contexts. c. Redefine the SELECT properties of the objects as indicated below: Rental Revenue
@aggregate_aware(sum(ANNUAL_FIGURES.ANNUAL_RENT_VALUE), sum(RENTAL.DAYS_RENTED * RENTAL_MODEL.SALE_QTY * MODEL.MODEL_DAYRENT *((100 - RENTAL.SALE_DISCOUNT) / 100)))

20

Advanced Universe DesignLearners Guide

Sales Revenue
@aggregate_aware(sum(ANNUAL_FIGURES.ANNUAL_SALE_VALUE), sum(SALE_MODEL.SALE_QTY * MODEL.MODEL_PRICE * ((100 - SALE.SALE_DISCOUNT) / 100)))

Number of Cars Sold


@aggregate_aware(sum(ANNUAL_FIGURES.ANNUAL_SALE_NUMBER), sum(SALE_MODEL.SALE_QTY))

Cost of Car Sales


@aggregate_aware(sum(ANNUAL_FIGURES.ANNUAL_SALE_COST), sum(SALE_MODEL.SALE_QTY * MODEL.MODEL_COST))

Financial Year
@aggregate_aware(ANNUAL_FIGURES.FP_YEAR,FINANCE_PERIOD.FP_YEAR)

d. Set incompatible objects manually by using Aggregate Navigation and check the results. Note: Define the Franchises object as incompatible. 3. Save the changes and test the annual level of aggregate awareness by making these queries in Web Intelligence Rich Client. Use the following objects in your query: Showroom, Financial Year, Sales Revenue, and Rental Revenue. Model, Financial Year, Sales Revenue, and Rental Revenue. Financial Year, Sales Revenue, and Financial Month. Ensure you view the inferred SQL in each instance. 4. Incorporate the QUARTER_FIGURES summary table in the Motors universe and apply aggregate awareness. Tip: You need to edit the @aggregate_aware syntax in the objects listed in step 2 to include the quarter level. In addition you need to apply the @aggregate_aware function to the Financial Quarter object. 5. Set incompatible objects manually by using Aggregate Navigation and check the results. Note: Define the Franchises object as incompatible. 6. Save the changes and test the quarter level of aggregate awareness by making three more queries in Web Intelligence Rich Client. Use the following objects in your query: Financial Year and Rental Revenue. Financial Year, Financial Quarter, and Rental Revenue. Financial Year, Financial Month, and Rental Revenue. 7. Test that the objects that are incompatible with both the ANNUAL_FIGURES and QUARTER_FIGURES summary tables infer SQL at the fact table level.

Working with Aggregate AwarenessLearners Guide

21

Activity: Setting up aggregate awareness - part 2


Objectives
Insert standalone summary tables into the Motors universe Apply aggregate awareness

Instructions
The DBA has created some aggregate tables in SQL Server Management Studio in the form of Views. The Views are to demonstrate the concept of Data Warehouse aggregate tables. Apply an aggregate awareness solution in your Motors universe, using the Views provided. These tables are incorporated into the schema as standalone tables. 1. In Universe Designer, open your Motors universe. 2. Incorporate the three summary tables (Views) in your Motors universe as standalone tables. View table values to verify that data is returned.

3. In the Sales Details class, add a new object called Order Count. Use the select statement:
count(SALE.SALE_ID)

4. Implement aggregate awareness to the objects in the Sales Dates class. Open the Sales Year Object. Modify the SELECT statement, applying the @aggregate_aware function:
@aggregate_aware(YEAR_ORDERCOUNT.Year, YEAR_QUARTER_ORDERCOUNT.Year, YEAR_QUARTER_MONTH_ORDERCOUNT.Year, {fn year( SALE.SALE_DATE )})

5. Parse the Sales Year object to verify the modified SQL syntax.

22

Advanced Universe DesignLearners Guide

6. Apply aggregate awareness to the Sales Quarter and Sales Month objects. The SQL used reflects similar syntax as applied in the Sales Year object. Parse the modified objects to verify that there are no errors in the SQL syntax. 7. Implement aggregate awareness to the Order Count object created in the Sales Details class. Parse the modified object syntax to ensure that there are no errors. 8. Set incompatibilities. 9. From the Tools menu launch the Query Panel. Run a query with Sales Year and Order Count. 10.Click the SQL icon. What is the result? Is this as expected, and why? 11.Edit the query and add the Sales Quarter object. Check the generated SQL. What is the result? Is this as expected, and why? 12.Edit the query and add the Sales Month object. Check the generated SQL. What is the result? Is this as expected, and why? 13.Run a new query in the Universe Designer Query Panel, using the Sale Date and Order Count objects. Check the generated SQL. What is the result? Is this as expected, and why?

Using aggregate awareness to resolve fan traps


The aggregate awareness functionality within BusinessObjects universe design can be viewed simply as a method for specifying preferential coding based on the other objects contained within a query. When viewed from this perspective, it becomes apparent that aggregate awareness can be used to resolve issues other than those for which it was originally intended. For instance, there is a particular fan trap scenario that, while it can be resolved using the classic fan trap solution, results in certain inefficiencies.

The fan trap scenario


Unlike the classic fan trap, the structure shown here involves two tables instead of three:

Working with Aggregate AwarenessLearners Guide

23

The standard fan trap resolution


Using the standard method for resolving a fan trap, you would: Create an alias of table A. Create a join from the alias An to table A and set cardinalities. Set contexts B and An. Edit object Y so that it refers to columns in the alias An rather than table A.

The efficiency problem


This standard fan trap solution resolves the fan trap solution if objects Y and Z are used in the same query. However, if a query involves only objects X and Y, then no fan trap exists, and yet table 1 is still processed twice (once as the alias An). You can overcome this inefficiency by applying aggregate awareness to the problem. The solution makes use of aggregate awareness functionality despite the fact that it does not involve a summary or aggregate table.

24

Advanced Universe DesignLearners Guide

After you have modified the universe by making one or more objects aggregate aware, as with any universe element, you must always test the results by building queries. To test the universe, build a query that uses the aggregated measures from table A. Use both compatible objects and incompatible objects in different queries to make sure all levels of aggregate awareness are operating correctly.

To resolve a two-table fan trap using @aggregate_aware


1. Create an alias of table A. 2. Create a join between the alias An and table A. 3. Set cardinality. 4. Set contexts An and B. 5. Apply the @aggregate_aware function to the Y object (the first choice referring to table A and then the alias An). 6. Make the Z object incompatible with table A.

Outer joins and aggregate awareness


A universe is a way to empower the users to create ad hoc queries to answer their business questions. The problem with this is you do not know what questions the user has, so the universe needs to be set up to take into account almost limitless possibilities. In this scenario, we have four tables joined with two equi joins and one outer join.

Working with Aggregate AwarenessLearners Guide

25

Initially, this appears to be perfectly in order, if the user creates a query using the Region and Client tables, they get back a list of Regions and Clients. The outer join specifies that the query returns all regions, even if there are no clients. The problem arises if the Sale table is included in the query. Effectively, the user asks the query to generate SQL joining an equi-join (from Sale) to a potentially blank row (no Client for an existing Region). The SQL may look correct, but depending on the RDBMS, the BusinessObjects querying tool may generate an error or produce incorrect results. In SQL Server the correct results are returned, however in Oracle no null values are retrieved, and in some databases, MS Access for example, an ambiguous join error is produced at query level. If this issue occurs with the RDBMS used, then there are two ways of solving this: 1. Do not use outer joins in your universe. This would not be practical if the users require blank rows to be returned. 2. Create an alias of the table where the outer join is required, and use aggregate aware in the relevant object(s) to identify which route to take when the user creates the query. Note: Depending on the RDBMS, the outer join placement may be different. In this example, the Client table is aliased, and the outer join is placed between the Region and the Client alias table. The outer join is now at the end of the path. The Region table has an equi-join to the original Client table.

26

Advanced Universe DesignLearners Guide

This is only half of the solution; the object needs to be changed, so that when the user creates the query and places, for example, the Client name object in the query, Universe Designer knows it has a choice of tables to get the information from - Client or Client2.
@aggregate_aware(CLIENT2.CLIENT_NAME,CLIENT.CLIENT_NAME)

Having told the object that it has two tables to get the same information from, the final step is to tell Universe Designer when to use which table - the Client or the Client2 alias. Using the Aggregate Navigation tool, the Client2 table needs to be made incompatible with any objects from the Sale table. By setting this, whenever a query is created using the Sale Type or Sale Total objects, Universe Designer cannot use the Client2 table (and therefore the outer join). However, if these objects are not included, then the Client2 table (and the outer join) is used.

Working with Aggregate AwarenessLearners Guide

27

Quiz: Working with aggregate awareness


1. How does the @aggregate_aware function improve query performance? 2. Why does using summary table data speed up response times? 3. The tool you use in Universe Designer to set incompatibilities between objects and tables in the structure of the universe is called the ___________________ tool.

28

Advanced Universe DesignLearners Guide

Lesson summary
After completing this lesson, you are now able to: Define aggregate awareness Apply aggregate awareness to objects

Working with Aggregate AwarenessLearners Guide

29

30

Advanced Universe DesignLearners Guide

Lesson 3

Designing Advanced Objects


Lesson introduction
You can create advanced objects that aid users in answering more specific questions in their reports. This lesson also looks at how database functions can be combined to create complex objects, how you can create relative date-time objects and how you can utilize analytic SQL functions, known as Transact_SQL functions in SQL Server. Note: The database functions mentioned and used in this lesson are for SQL Server. Refer to the SQL syntaxes for other RDBMS appendix for the equivalent functions and syntaxes in Oracle, DB2, or MySQL. After completing this lesson, you will be able to: Combine database functions in objects Construct relative date-time objects

Designing Advanced ObjectsLearners Guide

31

Combining database functions in objects


Initially, universes may only contain the basic dimension and detail objects that reflect the tables and column names in the universe structure, together with some more advanced measure objects that combine columns for aggregation of revenue or cost. When end users start building reports based on this universe, it may turn out that several business questions cannot be answered using the available objects. This often results in having end users define variables and complex formulas in their reports to get the required information shown. As a designer, it is important to identify what type of additional object functionality is needed to allow end users to generate the data in their report. In many cases instead of using report variables and functions, these reporting needs can be added in the universe in the form of more advanced objects. This unit describes a number of frequently used methods for creating complex objects. After completing this unit, you will be able to: Use and combine database functions in objects Create static and dynamic data ranges

Using database functions in objects


When connecting your universe to a specific RDBMS, the <driver>.PRM file makes a list of database functions available in the universe. The PRM file, a connection parameter file, contains default SQL parameters used for query generation, date and other operators, and functions. The function list shown in the PRM file never includes a complete list of available functions for the designated RDBMS. The list of default functions made available in the PRM file for the used RDBMS is shown in Universe Designer, divided into Number, Character, and Date types.

When working in Universe Designer, besides from selecting functions from the list, you can add SQL functions directly into the Select field of an object, provided that the underlying data source supports the SQL function used. This section looks at some of the most commonly used numeric and character functions that can be used for complex dimension and detail objects. The list of numeric functions consists of a number of aggregate functions that can be used in measure objects, and several mathematical and statistical functions. The list of character functions consists of several functions that allow you to extract data-parts, and some conversion functions.

32

Advanced Universe DesignLearners Guide

On their own each function may give limited functionality, but when combining two or more functions in a SELECT statement, they allow designers to construct complex objects that may benefit the end users in their report creation.

CharIndex, Length, Left, Right, and Substring functions


Note: The SQL statements in this table are for SQL Server 2005. Alternative SQL syntaxes for Oracle, MySQL, and DB2 are available in the SQL syntaxes for other RDBMS appendix.
Function Description

Fn_Left (or Left)

Returns a number of character values from the left-hand side of a string. Returns a number of character values from the right-hand side of a string. Returns the position of an expression in a character string. Returns the length of a character string. Returns part of a character string. The substring starts at a specified character position and has a specified length.

Fn_Right (or Right)

Charindex

Fn_Length

Substring

These functions can be used to establish a character string length by using the length function. The substring, left and right functions can allow extracting values of a specified length from either the start or end part of a character string. Charindex can establish the position of a character value in a string. Combining these functions can allow designers to extract string values from any part of a table column. For example, if for a Zoning Improvement Plan (ZIP) code, or Postal Code, only the first group of values, representing the local Area Code are required. For example, "SL6", "W1" or "NW6". However, the group of values can be either two or three characters long ("W1", or "NW6"). This can pose a problem with using the left or substring function as it is unknown how many character values need to be extracted. The common delimiter is the space or hyphen that separates the first part of the ZIP code, or Postal Code, from the second. If the position of the space is known, then this can be the deciding factor of how many values to extract from the left-hand side. Charindex can be used to establish the position of the space in this string:
charindex(' ',CLIENT.CLIENT_AREA_CODE)

You can now define data up to the space from either left or right. The following syntax provides the first digits of the ZIP code, or Postal Code, up to the dividing space:
rtrim(substring(CLIENT.CLIENT_AREA_CODE,1,charindex(' ', CLIENT.CLIENT_AREA_CODE)))

Designing Advanced ObjectsLearners Guide

33

Note: The rtrim function is used to remove the space (on the right) from the substring.

Ceiling, Floor, Round, and CAST functions


These functions can be used to round down or round up to a last digit or integer of a number value. The CAST function is a conversion function that can be used to convert number values to strings.
Function Description

Ceiling

Returns the smallest integer greater than or equal to n. It returns the decimal value rounded up to the next integer value. For example, Ceiling(2.3) returns a value of 3. Returns the largest integer less than or equal to n. It returns the decimal value rounded down to the next integer value. For example, Floor(6.987) returns a value of 6. Returns a number rounded to n decimal places. Converts data from one data type to another.

Floor

Round

CAST

Rounding up and rounding down of values can be useful to make sure that number formats do not have unnecessary decimal places. This can be useful for object formatting, and for certain measure calculations. These functions can also be used in creating data range objects. In the Client table there is a value for Client_Age, and the end user likes to be able to run a query showing the customer age and the age range the customer falls into. For example, 10-19, 20-29, 30-39, and so forth. You can use the CAST function to convert and combine the two strings. The formula becomes:
CAST((floor(CLIENT.CLIENT_AGE/10)*10) as varchar)+'-'+ CAST((((floor(CLIENT.CLIENT_AGE/10)+1)*10)-1) as varchar)

This allows end users to run an age range object with a range increment of 10, in their reports.

34

Advanced Universe DesignLearners Guide

CASE WHEN THEN ELSE END


The CASE statement allows designers to locate a value and replace it by something else. This is a powerful SQL syntax function that can aid in complex conditional syntaxes. In the BusinessObjects XI 3.0/3.1: Universe Design course, the CASE statement was used to allow creating sales revenue by year if the year is a certain value.

Function element

Description

The input_expression is any valid expression.


CASE input expression

For example:
CASE CLIENT.CLIENT_LASTNAME

WHEN when_expression

The when_expression is a simple expression to which the input_expression is compared. The data types of input_expression and each when_expression must be the same. For example:
CASE CLIENT.CLIENT_LASTNAME WHEN 'Brent'

THEN result_expression

The result_expression is the expression returned when the input_expression equals when_expression evaluates TRUE, or Boolean_expression evaluates to TRUE. The result_expression is any valid expression. For example:
CASE CLIENT.CLIENT_LASTNAME WHEN 'Brent' THEN 1

ELSE else_result_expression

The else_result_expression is the expression returned if no comparison operation evaluate to TRUE. If this argument is omitted and no comparison operation evaluates to TRUE, CASE returns NULL. The else_result_expression is any valid expression, however the data types of the else_result_expression and any result_expression must be the same or must be an implicit conversion. For example:
CASE CLIENT.CLIENT_LASTNAME WHEN 'Brent' THEN 1 ELSE 0

Designing Advanced ObjectsLearners Guide

35

Function element

Description

The END component ends the CASE statement syntax. For example:
CASE CLIENT.CLIENT_LASTNAME WHEN 'Brent' THEN 1 ELSE 0 END

END

Any additional CASE statements can be placed before the END syntax to evaluate a further list of conditions. An END syntax for each additional CASE statement is required. For example:
CASE CLIENT.CLIENT_LASTNAME WHEN 'Brent' THEN 1 ELSE 0 (CASE CLIENT.CLIENT_LASTNAME WHEN 'Cooley' THEN 1 ELSE 0 END) END

The CASE statement can be used in objects, conditions, joins and derived tables allowing for great flexibility in universe design. An example syntax for the CASE statement is:

Note: The CASE statement is not a condition in itself. It is only a value assignment. This means that it allows you to combine as many CASE statements (nested within each other) as you want. On the other hand you need to add extra conditions to ensure the restriction actually works and no empty rows are created.

Activity: Combining database functions in objects


Objectives
Create a data range object Extract data from a string

Instructions: Create a data range object


The end user would like to be able to run a query showing the customer age and the age range the customer falls into. For example, 10-19, 20-29, 30-39, and so forth. Using the floor and CAST functions, create an Age Range object based on the CLIENT.CLIENT_AGE column. 1. Add a new Client Age object in the Client class. 2. Create a new age range object, using a range band of 10.

36

Advanced Universe DesignLearners Guide

For example, the range object needs to show the lower range value of 40, and the upper range value of 49, when the CLIENT.CLIENT_AGE value is 44. Note: Ensure that the brackets are in the right location to get the correct calculation order. 3. Click Apply and OK to save the object changes. 4. Test the new object in Web Intelligence Rich Client. 5. In Universe Designer create a copy of the Age Range object. Rename the object Dynamic Age Range. 6. Edit the Dynamic Age Range SELECT syntax. Replace the value 10 by the following @prompt function syntax:
(@prompt('Enter Range Increment','N',,,))

The formula used in the object now becomes:


CAST((floor(CLIENT.CLIENT_AGE/(@prompt('Enter Range Increment','N',,,)))*(@prompt('Enter Range Increment','N',,,))) as varchar) +' - '+CAST((((floor(CLIENT.CLIENT_AGE/(@prompt('Enter Range Increment' ,'N',,,)))+1)*((@prompt('Enter Range Increment','N',,,)))-1) as varchar)

Note: Remember that it is useful to add a help text for this type of object to let the end user know what type of value they are expected to fill into the prompt. For example, in this case it can be noted that the end user can enter into the prompt values like 5, 10, 15, 20, and so forth. 7. Click Apply and OK to save the object changes. 8. As the universe has Aggregate Awareness assigned, it is good practice to set any new objects to be either compatible or incompatible with these tables. In this instance, Age Range is a new object in the client class. Ensure that the client class is incompatible with the annual figures, quarter figures, year order count, year quarter order count, and year quarter month order count tables. Save the change to your universe. 9. Test the results in Web Intelligence Rich Client.

Instructions: Extract data from a string


This activity can be completed using a combination of functions like: CASE, left, right, length, substring, or charindex. 1. Using any combination of the functions mentioned above in combination with the CASE statement, create a new Phone Area Code object that extracts the area code value from the Phone NO. If there is no area code value ensure the entire Phone NO is displayed. 2. As the universe has Aggregate Awareness assigned, it is good practice to set any new objects to be either compatible or incompatible with the summary tables used in your schema. Save the change to your universe.

Designing Advanced ObjectsLearners Guide

37

Working with analytic functions


Universe Designer supports the use of analytic functions for specific RDBMS. Analytic functions are called RISQL functions in RedBrick, OLAP functions in Teradata, and are known as Transact_SQL functions in SQL Server. You can use Universe Designer to define analytic functions for objects in a universe. End users can use analytic functions to perform data analysis that is not normally possible within the reporting capabilities of the BusinessObjects reporting tools.

What are analytic functions?


An analytic function is a function that performs an analytical task on a result set that can be divided into ordered groups of rows or partitions. Analytic functions compute an aggregate value based on a group of rows. They differ from aggregate functions in that they return multiple rows for each group. The group of rows is called a window and is defined by the analytic_clause. For each row, a sliding window of rows is defined. The window determines the range of rows used to perform the calculations for the current row. Window sizes can be based on either a physical number of rows or a logical interval such as time.

Function element

Description

analytic_clause

Use OVER analytic_clause to indicate that the function operates on a query result set. That is, it is computed after the FROM, WHERE, GROUP BY, and HAVING clauses. You can specify analytic functions with this clause in the select list or ORDER BY clause.
Note: You cannot specify any analytic function in any part of the analytic_clause. That is, you cannot nest analytic functions.

38

Advanced Universe DesignLearners Guide

Function element

Description

query_partition_clause

Use the PARTITION BY clause to partition the query result set into groups based on one or more value_expr. If you omit this clause, then the function treats all rows of the query result set as a single group. Valid values of value_expr are constants, columns, non-analytic functions, function expressions. Use the order_by_clause to specify how data is ordered within a partition. you can order the values in a partition on multiple keys, each defined by a value_expr and each qualified by an ordering sequence.
Note: Aggregate analytic (Transact_SQL) functions for SQL Server do not allow the use of the ORDER BY. This may differ with other RDBMS that support these type of functions.

order_by_clause

Analytic functions are the last set of operations performed in a query except for the final ORDER BY clause. All joins and all WHERE, GROUP BY, and HAVING clauses are completed before the analytic functions are processed. Therefore, analytic functions can appear only in the select list or ORDER BY clause. In Universe Designer you can define objects with analytic functions to calculate rankings, cumulative aggregates, and ratios within one or more partitions. Depending on your RDBMS, you can also define the range of rows on which you want to apply the analysis within the partition. Note: For a full description of analytic functions refer to your RDBMS documentation.

ROW_NUMBER
The most basic ranking function is ROW_NUMBER. ROW_NUMBER returns a column as an expression that contains the rows number within the result set. This is only a number used in the context of the result set, if the result changes, the ROW_NUMBER value changes. The ROW_NUMBER expression is used with the following additional clauses: OVER: Determines the partitioning and ordering of the rowset before the associated window function is applied. PARTITION BY: Divides the result set into partitions. The window function is applied to each partition separately and computation restarts for each partition. ORDER BY: Specifies the sort order used on columns returned in a SELECT statement. Note: If you choose the ROW_NUMBER function to run against a non-unique column, it breaks the tie and still produces a running count so no rows have the same number. An example ROW_NUMBER SQL Statement is as follows:
SELECT ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY CLIENT_ID) AS SURROGATE, * FROM CLIENT

Designing Advanced ObjectsLearners Guide

39

RANK
RANK works a lot like ROW_NUMBER and uses the same expression clauses as described in the ROW_NUMBER section.

The main difference is that the RANK function does not break ties, you do not get a unique value for ties. The RANK function assigns the same key if the value is the same.

Aggregate analytic functions


In addition to the ranking options, you can use the OVER and PARTITION BY elements in combination with aggregate functions like Count, Sum, Min, Max, and Average. Note: Analytic functions can be added directly to the Select field if the RDBMS allows their use. However, to ensure correct use of the aggregate analytic functions, the RISQL functions parameter, and Over Clause parameter need to be enabled in the PRM file. For most RDBMS this has been set as standard, but this is not the case for SQL Server. The PRM file is a system file and a backup of the file needs to be made prior to making changes. For aggregate analytic functions, the following two parameters need to be added to the PRM file configuration section:
<Parameter Name="RISQL_FUNCTIONS">RANK,SUM,AVG,COUNT, MIN,MAX,DENSE_RANK,NTILE,ROW_NUMBER</Parameter> <Parameter Name="OVER_CLAUSE">Y</Parameter>

The RISQL functions parameter lists the supported by the database, and this list is different for each RDBMS. The Over Clause parameter allows BusinessObjects products to include aggregate analytic functions (for example, SUM() OVER (PARTITION BY))when generating SQL. Depending on the database used, in the PRM file you may also need to apply parameter rules for the GROUP BY clause. Consult the BusinessObjects XI 3.0/3.1: Designer's Guide for more information on analytic functions and the PRM file.

40

Advanced Universe DesignLearners Guide

Constructing relative date-time objects


Discuss the unit objectives. Every universe has a need for relative time objects that end users can use to make calculations based on current dates or based on a prompted dynamic period. This unit looks at how you can create different types of relative date-time objects. After completing this unit, you will be able to: Create relative date-time objects based on a prompted period Create current date-time objects Create YTD objects

Date functions in objects


Every now and then, you need to take the current date and calculate some other date. For example, end users might need to determine what date is the first day of the month, or need to know the last day of the month. There are a number of functions listed in the Number list that can apply to these needs. The examples listed below are for SQL Server, and may differ for other Relational Database Management Systems (RDBMS): fn_year: This function returns the year values of a date object. For example:
{fn year(FINANCE_PERIOD.FP_START)}

This example returns the values 2003, 2004, and 2005 in numeric format. fn_month: This function returns the month values of a date object. For example:
{fn month(FINANCE_PERIOD.FP_START)}

This example returns the values 1-12 in numeric format. Note: If there is no date value in the database Fp_Start column for a particular month, this month value is not included in the LOV. fn_week: This function returns the week values of a date object. For example:
{fn week(FINANCE_PERIOD.FP_START)}

This returns the values 1-52 in numeric format. Note: If there is no date value in the database Fp_Start column for a particular week, this week value is not included in the LOV. datepart(qq, ): This function returns the quarter values of a date object. For example:
Datepart(qq, FINANCE _PERIOD.FP_START)

This example returns the values 1-4 in numeric format.

Designing Advanced ObjectsLearners Guide

41

Note: The datepart function can also be used to extract year, month, week, and day numeric values. You can also use the dateadd and datediff functions to calculate a number of different dates you might need to use in your applications. And for a current date value the function getdate can be used.
Note: If database functions are typed in directly, do ensure that the object parses and run test queries to ensure the object does not cause any errors.

The datediff function calculates the amount of time between two dates, where the time part is based on an interval of time, such as hours, days, weeks, months, or years. The dateadd function calculates a date by taking an interval of time, and adding it to a date, where the interval of time is the same as those used by the datediff function. Combining these two functions and getdate, a SQL Server function that returns the current date and time, can aid retrieving first and last day of the month or year information, for example: First Day of Month:
dateadd(mm,datediff(mm,0,getdate()), 0)

The datediff(mm,0,getdate()) section of the syntax above calculates the number of months between the current date and the date "1900-01-01 00:00:00.000". In SQL Server date and time variables are stored as the number of milliseconds since "1900-01-01 00:00:00.000". This is why you can specify the first date-time expression of the datediff function as "0." The dateadd function adds the number of months between the current date and '1900-01-01". By adding the number of months between our predetermined date '1900-01-01' and the current date it is possible to arrive at the first day of the current month. In addition, the time portion of the calculated date becomes "00:00:00.000." Monday of the Current Week:
dateadd(wk,datediff(wk,0,getdate()),0)

Note: This example assumes Sunday is the first day of the week. First Day of the Year
dateadd(yy,datediff(yy,0,getdate()),0)

First Day of the Quarter


Dateadd(qq,datediff(qq,0,getdate()),0)

By using this simple dateadd and datediff calculation you can come up with many different dates that might be valuable. Here are some examples that add an additional dateadd function to calculate the last day dates for both the current and prior intervals. Last Day of Prior Month
dateadd(ms,-3,dateadd(mm,datediff(mm,0,getdate()),0))

42

Advanced Universe DesignLearners Guide

Last Day of Prior Year


dateadd(ms,-3,dateadd(yy,datediff(yy,0,getdate()),0))

First Monday of the Month


dateadd(wk,datediff(wk,0,dateadd(dd,6-datepart(day,getdate()), getdate())),0)

Using the sixth day of the month instead of the current date in the formula allows this calculation to return the first Monday of the current month.

Relative date-time objects


In many instances universes are designed that only directly reflect the contents and structure of the underlying database. When building a report based on this universe, it turns out that many questions cannot be answered using the simple objects that are available. Examples of these questions are: What is the sales revenue from January 1st up to today? How does this quarter's sales revenue compare to the same quarter last year? Web Intelligence Rich Client enables a user to answer these questions by using advanced formulas and calculations. If these report-based formulas are required by many users, instead of having each individual user apply them you can extend the universe with additional complex objects and predefined conditions. Each database has a number of date functions that give you the base syntaxes for a current date, current year, current month, and by adding, or subtracting numbers you can create previous and future date syntaxes. For example in SQL Server you can use the following SQL syntaxes:
Date Object SELECT syntax Description Type

Current Date Current Year Current Month

getdate()

Returns the current date and time.

Date

datepart(yyyy,getdate())

Returns the current year.

Number

datepart(mm,getdate())

Returns the current month.

Number

Next Year

dateadd(mm,12,getdate())

Returns today's date a year ahead.

Date

Adding date objects based on database date functions to the universe gives end users more flexibility in their reporting requirements.

Designing Advanced ObjectsLearners Guide

43

Note: Date function syntaxes can be used in predefined conditions as well as in objects.

CASE statements in measure objects


Creating universe objects that compare date function syntaxes with existing database columns, extends further reporting functionality. To accomplish this, you can use the CASE statement to construct "If Then Else" logic. For example:
CASE WHEN (datepart(yyyy,getdate())-1) = {fn_year(FINANCE_PERIOD.FP_START)} THEN 1 ELSE 0 END CASE statements can be further extended by using @functions:

@prompt @select

The @prompt function in CASE statements


In addition to the date function syntaxes, you may need to have specific date-time prompts that allow users to input a date of their choice. The prompt can be referenced in objects to compare a user input date with an existing date in the database. The CASE statement can be used to combine the database functions and the @prompt functionality. For example:
CASE WHEN {fn_year(FINANCE_PERIOD.FP_START)}= @prompt('Select year','N',,mono,free) AND {fn_month(FINANCE_PERIOD.FP_START)}= @prompt('Select month','N',,mono,free) THEN 1 ELSE 0 END

The @select function in CASE statements


The example CASE statement shows the use of the fn_year and fn_month functions to format a date column to a year or month. If your universe already contains a financial year and a financial month object, these objects can be referenced in the CASE statement using the @select functionality. The @select function is an internal function that allows you, as the designer, to reuse universe objects without forcing you to repeat the entire SQL syntax. The @select function comes in very handy when building complex objects. For our previous CASE statement example you can use @select to substitute the database column Fp_Start if this already exists as an object in the universe:
CASE WHEN @select(Financial Period\Financial Year) = @prompt('Select year','N',,mono,free) AND @select(Financial Period\Financial Month)= @prompt('Select month','N',,mono,free) THEN 1 ELSE 0 END

44

Advanced Universe DesignLearners Guide

Re-use of prompt syntaxes can be handled in the same way. You can create base date prompt objects, that can be hidden to end users if needed, and use these as reference in other objects. For example:
Prompt Object SELECT syntax @prompt('Select date','D','Financial Period\FP Start',mono,free)

Date Prompt Year Prompt Month Prompt

@prompt('Select year','N','Financial Period\Financial Year',mono,free) @prompt('Select month','N','Financial Period\Financial Month',mono,free)

For our previous CASE statement example you can use @select to substitute the database column and the prompt syntax if both already exist as objects in the universe:
CASE WHEN @select(Financial Period\Financial Year) = @select(Prompt Objects\Year Prompt) AND @select(Financial Period\Financial Month)= @select(Prompt Objects\Month Prompt) THEN 1 ELSE 0 END

The advantage of the @select function is that it allows you to specify SQL code only once. If you change a database column in the RDBMS you only need to modify the SQL of the base object; Universe Designer automatically updates the SQL for all other objects that use the base column. Tip: When using @select, you can still see the full SQL statement by enabling the check box Show Object SQL in the SQL Editor. When all base syntax components have been constructed, a CASE statement can be used to combine the functions and build boolean "reference" objects, or "flags" that can be used to build relative-time measures objects. Note: You can also construct the CASE statement , using boolean logic, separating statements using an asterisk; the asterisk ensures that both CASE statements return a 1 value:
CASE @select(Financial Period\Financial Year) WHEN @select(Prompt Objects\Year Prompt) THEN 1 ELSE 0 END * CASE @select(Financial Period\Financial Month) WHEN @select(Prompt Objects\Month Prompt) THEN 1 ELSE 0 END

Designing Advanced ObjectsLearners Guide

45

Activity: Constructing relative date-time objects


Objectives
Create relative date-time reference objects Use the reference objects as a base to build relative date-time measures

Instructions
Prompt objects are constructed using database date functions, to return an input base for end users to enter a year, month, or a full date value. These prompted values are compared to the actual database date column (or datepart), for example SALE.SALE_DATE. A CASE statement can be used to compare the prompted period with the actual database column period, and build boolean "reference" objects, or "flags" that can be used to build relative date-time measures objects. If the prompted period input value matches the actual database column period, the CASE statement returns a 1 value. After creating the boolean flags, the final stage is to build the relative date-time measure objects. For each 1 value of the boolean flag, the relative date-time measure value is returned. Note: This activity uses the @select function to reference already created objects. The @select function is an internal function that allows you, as the designer, to reuse universe objects without forcing you to repeat the entire SQL syntax. The @select syntax used in this activity can be generated by selecting the objects and functions in the Edit Select menu. 1. In Universe Designer, open your Motors universe file. 2. Create a new YTD Date Objects subclass in the Sales class. 3. Create the following sale date prompt objects in the YTD Date Objects subclass. Sales Date Prompt:
@prompt('Select Date or Type Date (dd/mm/yyyy)','D','Sales Dates\Sale Date',mono,free)

SELECT

syntax:

Note: The Sales Date Prompt object contains an @prompt syntax in the SELECT clause. Normally an @prompt is handled in the WHERE clause and the SELECT contains the table.column reference. For the purpose of feeding through the prompted value into other object SELECT clauses using the @select function, the @prompt requires to be placed in the Sales Date Prompt object SELECT clause. The table reference is set via the Tables button. The @prompt syntax only parses when it is set to a Character type. It is viewed as constant, as there is no date column referenced. Setting the object to Character type does not affect the outcome of the activity.

Description:

Prompts the user to choose a sales date from the list of values or manually type in a date value (YYYYMM).

46

Advanced Universe DesignLearners Guide

Type: Tables button:

Character (see Note above for details).

Select SALE as the reference table.

Sales Year Prompt:


SELECT datepart(yyyy,@select(YTD Date Objects\Sales Date Prompt))

syntax:

Description: Type:

Subtracts the year from the entered sales date prompt value. Number

Sales Month Prompt:


SELECT

datepart(mm,@select(YTD Date Objects\Sales Date Prompt))

syntax: Description: Type: Subtracts the month from the entered sales date prompt value. Number

4. In the YTD Date Objects subclass, create the following indicator or boolean flag objects that are used to create relative date-time measure objects in the remaining activity steps. Note: The boolean flag objects need to be hidden. They should not be used by end users as objects on their own. Tip: The @select statements shown in the table can be generated by selecting the objects and functions in the Edit Select menu.
Sales Date in Prompt flag SELECT syntax CASE WHEN @select(Sales Dates\Sales Year) = @select(YTD Date Objects\Sales Year Prompt) AND @select(Sales Dates\Sales Month) = @select(YTD Date Objects\Sales Month Prompt) Description

Indicator that returns 1 if both the year and the month of the sales date are equal to the year and month in the entered

Designing Advanced ObjectsLearners Guide

47

SELECT syntax THEN 1 ELSE 0 END

Description

prompt date. Otherwise it returns 0.

Sales Month in Prompt flag SELECT syntax CASE WHEN sign(@select(Sales Dates\Sales Year)+1 @select(YTD Date Objects\Sales Year Prompt)) = 0 AND sign(@select(Sales Dates\Sales Month) @select(YTD Date Objects\Sales Month Prompt)) = 0 THEN 1 ELSE 0 END Description

Indicator that returns 1 if the year of the sales date equals the year in the entered prompt date minus one year, and the month of the sales date equals the month of the reference period. Otherwise it returns 0.

Sales Year in Prompt flag SELECT syntax CASE WHEN @select(Sales Dates\Sales Year) = @select(YTD Date Objects\Sales Year Prompt) AND sign(@select(Sales Dates\Sales Month) (@select(YTD Date Objects\Sales Month Prompt)-1) = 1 THEN 1 ELSE 0 END Description

Indicator that returns 1 if the month of the sales date <= sales month prompt, and the year of the sales date is equal to the sales year prompt. Otherwise it returns 0.

Note: The first part of the Sales Year in Prompt flag statement compares the year values. If the year selected in the prompt matches the year value in the date this returns the sale date values for those rows. The second part of the statements subtracts the month value selected in the prompt(-1) from each value in the sale date rows returned. The sign function does the following: if the subtraction value is a minus value it returns -1, if the subtraction value ends in 0 it returns 0, if the subtraction value ends up in a positive value, it returns 1. If a sale date of 4/3/2004 is selected in the prompt, the datepart(mm) changes this to a value of 4. The -1 part of the formula changes this value to 3 as the prompt input value. When the prompted period value (3) is subtracted from the month value (4) a positive value is returned and ends in 1. With the CASE statement this ensures that month 4 is included in the values returned. 5. Hide the entire YTD Date Objects subclass. 6. Create a new YTD Measure Objects subclass in the Sales class. 7. Create the following relative date-time measure objects in the YTD Measure Objects subclass:

48

Advanced Universe DesignLearners Guide

Tip: The @select statements shown in the table can be generated by selecting the objects and functions in the Edit Select menu.
Measure Object SELECT Syntax sum(SALE.SALE_TOTAL)

Sales Total Total Sales in prompted yyyy-mm period Total Sales in prompted year period Total Sales in prompted year period - 1yr

sum((SALE.SALE_TOTAL)* @select(YTD Date Objects\Sales Date in Prompt flag))

sum((SALE.SALE_TOTAL)* @select(YTD Date Objects\Sales Year in Prompt flag))

sum((SALE.SALE_TOTAL)* @select(YTD Date Objects\Sales Month in Prompt flag))

8. As the universe has aggregate awareness assigned, it is good practice to set any new objects to be either compatible or incompatible with the summary tables used in your schema. Ensure that the YTD Measure Objects and YTD Date Objects are incompatible with the annual figures, quarter figures, year order count, year quarter order count, and year quarter month order count tables. Save the change to your universe. 9. Save the changes and test your universe using Web Intelligence Rich Client. 10.Create a new query using Sale Date, Sales Total, and Total Sales in prompted yyyy-mm period. 11.Select a date from the LOV. The Total Sales in prompted yyyy-mm period object returns only sales data for the month and year values that equal the month and year values entered in the prompt, all other rows return 0. This way end users can compare the total sales revenue for all dates to the sales revenue returned for the selected yyyy-mm period. 12.Run a second query using the Sale Date, Sales Total, and Total Sales in prompted year period objects. 13.Select a date from the LOV. Note: There is no data for 2002, so ensure to select a date from 2004 or 2005 to see the last year values. The Total Sales in prompted year period object returns only sales data for the month and year values that equal the month and year values entered in the prompt. All other rows return 0.

Designing Advanced ObjectsLearners Guide

49

14.Run a new query using the Sale Date, Sales Total, and Total Sale - 1yr objects. 15.Select a date from the LOV. Note: There is no data for 2002, so ensure to select a date from 2004 or 2005 to see the last year values. The Total Sales in prompted year period - 1yr object returns only sales data for the month and year values that equal the month and year values entered in the prompt minus 1 year. All other rows return 0.

Moving averages
In statistics, a moving average or rolling average is one of a family of similar techniques used to analyze time series data. A moving average series can be calculated for any time series. In finance it is most often applied to stock prices, returns, or trading volumes. Moving averages are used to smooth out short-term fluctuations, thus highlighting longer-term trends or cycles. The threshold between short-term and long-term depends on the application, and the parameters of the moving average are set accordingly. A moving average through time is the unweighted mean of the previous N data points. For example, a 10-day simple moving average of closing price is the mean of the previous 10 days' closing prices. If those prices are pN,pN 1... pN 9 then the formula is:

This type of average is also referred to as a moving average through time, or MAT. In the Motors universe you do not have a day level of granularity, but can calculate the moving average using the time periods from the Financial Period table, using month as the granularity level. In the example shown, a derived table and an alias have been added to the structure.

50

Advanced Universe DesignLearners Guide

To create a moving average in a universe you require the following: A derived table with @prompt or @variable. A fact table. An alias of the fact table. A time period (dimension) table. Contexts. The derived table acts as the N time period input via the Start_N_Periods column. This is done using the @prompt function in the table SQL syntax. For example:
SELECT Distinct FINANCE_PERIOD.FP_YEAR, FINANCE_PERIOD.FP_MONTH, dateadd(month,-@prompt('how many periods?','N',,,,),FINANCE_PERIOD.FP_END) as START_N_PERIODS, FINANCE_PERIOD.FP_START, FINANCE_PERIOD.FP_END FROM FINANCE_PERIOD

Note: For some RDBMS the @prompt function needs to be substituted by @variable. For more information on the use of @variable consult the BusinessObjects Designer's Guide. The Sale table alias is the source for the MAT measure data, based on the prompted N time period value that is fed through the join between the alias and the derived table. Contexts are required to separate the Sale and Sale_MAT fact tables, otherwise you would have a potential SQL Trap in your schema. A Sale_MAT context:

A Sale context:

Designing Advanced ObjectsLearners Guide

51

The final stage is to create the actual objects that the user can run to display the Sale Total MAT values. In this example the Sale Total MAT object consists of the Sale_Total column from the Sale_MAT table and the @prompt syntax used to get the number of periods:
sum(SALE_MAT.SALE_TOTAL)/@prompt('how many periods?','N',,,,)

When a user runs a query with Financial Year, Financial Month, the Sales Total from the original Sale table, the Sales Total N Period (Sale_Total from the alias table), and Sales Total MAT, the user is prompted for the number of periods required for the moving average.

The report displays the sales total values. The Sales Total N Periods column shows the accumulated values based on the number of periods (in our example 2), and the Sales Total MAT column shows the accumulated values divided by the number of periods.

52

Advanced Universe DesignLearners Guide

Activity: Creating a moving average


Objectives
Create moving average objects Test the moving average objects in Web Intelligence Rich Client

Instructions
1. In your Motors universe create a SALE_MAT alias table. Note: The self-restricting join for the SALE.SALE_TYPE column needs to be manually created for the SALE_MAT alias table. 2. Create a new Derived Table, called DT_Date_N_Periods, using the following syntax:
SELECT Distinct FINANCE_PERIOD.FP_YEAR, FINANCE_PERIOD.FP_MONTH, dateadd(month,-@prompt('How many periods?','N',,,,),FINANCE_PERIOD.FP_END) as START_N_PERIODS, FINANCE_PERIOD.FP_START, FINANCE_PERIOD.FP_END FROM FINANCE_PERIOD

3. Join the DT_Date_N_Periods table to the SALE_MAT table using a theta-join; using the START_N_PERIODS, FP_END, and SALE_DATE columns.
SALE_MAT.SALE_DATE between DT_Date_N_Periods.START_N_PERIODS and DT_Date_N_Periods.FP_END (N:1)

Designing Advanced ObjectsLearners Guide

53

4. Join the DT_Date_N_Periods table to the FINANCE_PERIOD table using a complex join; joining month and year columns in both tables.
DT_Date_N_Periods.FP_YEAR = FINANCE_PERIOD.FP_YEAR and DT_Date_N_Periods.FP_MONTH = FINANCE_PERIOD.FP_MONTH (1:1)

5. Join the SALE_MAT table to the CLIENT, SHOWROOM, and SALE_MODEL tables. Set the appropriate cardinalities. (These are the same as the joins from the SALE table. ) 6. Create a SALE_MAT context. Tip: This context mirrors the existing SALES context and should consist of 19 joins. You can make a copy of the SALES context as follows: 1. Open List Mode, and select the SALES context. 2. Right-click the SALES context in the Context zone in List Mode. Select Insert Context. 3. The New Context window appears, with all joins from the original SALES context selected. 4. Name the context SALES_MAT and remove all joins referring to the original SALE table:
CLIENT.CLIENT_ID = SALE.CLIENT_ID SHOWROOM.SHOWROOM_ID = SALE.SHOWROOM_ID SALE.SALE_ID = SALE_MODEL.SALE_ID SALE.SALE_TYPE = 'S' SALE.SALE_DATE between FINANCE.FP_START and FINANCE.FP_END

5. Replace the removed joins with the SALE_MAT alias table joins. Ensure all newly created joins are included in the SALE_MAT context. 7. In the Sales class, create a new Sales MAT subclass. Insert the following objects: Sales Total
sum(SALE.SALE_TOTAL)

Note: A Sales Total object, with the same SELECT syntax, already exists in the YTD Measure Objects subclass, and instead of creating a new object with the same syntax, you can create a new object in the Sales MAT subclass that references the existing Sales Total object using the @select function.
@select(YTD Measure Objects\Sales Total)

Sales Total N Periods (MAT)


sum(SALE_MAT.SALE_TOTAL)

Sales Total (MAT)


sum(SALE_MAT.SALE_TOTAL)/@prompt('How many periods?','N',,,,)

Financial Year (MAT)


FINANCE_PERIOD.FP_YEAR

54

Advanced Universe DesignLearners Guide

Note: Either use the syntax shown above, or use the @select function to reference the existing Financial Year object in the Finance Period class.
@select(Finance Period\Financial Year)

Financial Month (MAT)


FINANCE_PERIOD.FP_MONTH

Note: Either use the syntax shown above, or use the @select function to reference the existing Financial Month object in the Finance Period class.
@select(Finance Period\Financial Month)

8. As the universe has Aggregate Awareness assigned, it is good practice to set any new objects to be either compatible or incompatible with the summary tables used in your schema. Ensure that the Sale MAT objects are incompatible with the annual figures, quarter figures, year order count, year quarter order count, and year quarter month order count tables. Save the change to your universe. 9. Save your changes and launch Web Intelligence Rich Client. Create a query with all objects in the Sales MAT class, Test the report using different number of periods. Your report should look similar to this:

The report displays the Sales Total column, which references the original SALE table. The Sales Total N Periods column shows the accumulated sales total values based on the number of periods (for example Sales Total from Month 01 and Month 02), the Sales Total MAT column shows the accumulated values divided by the number of periods (for example Sales Total from Month 01 and Month 02, divided by 2). 10.Test the report by adding dimension objects, for example Showroom Country. Apply a section or break, to get a better overview of the results. Your report should look similar to this:

Designing Advanced ObjectsLearners Guide

55

56

Advanced Universe DesignLearners Guide

Quiz: Designing advanced objects


1. True or False: You can use all database functionality over and above what is listed in the functions list in the Select and Where fields. 2. List three different analytic(Transact-SQL) functions. 3. True or False. The @select function is an internal function that allows you, as the designer, to reuse universe objects without forcing you to repeat the entire SQL syntax.

Designing Advanced ObjectsLearners Guide

57

Lesson summary
After completing this lesson, you are now able to: Combine database functions in objects Construct relative date-time objects

58

Advanced Universe DesignLearners Guide

Lesson 4

Creating Complex Predefined Conditions, LOVs, and Joins


Lesson introduction
This lesson looks at how you can create complex predefined conditions, that can aid users to answer more specific questions in their reports. This lesson also looks at how LOVs can be customized to have an "ALL values" entry, and at prompts and conditional uses in joins. Note: The database functions mentioned and used in this lesson are for SQL Server. Refer to the SQL syntaxes for other RDBMS appendix for the equivalent functions and syntaxes in Oracle, DB2, or MySQL. After completing this lesson, you will be able to: Create complex predefined conditions Work with advanced LOVs Work with advanced join syntaxes

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

59

Creating complex predefined conditions


This unit looks at how you can make use of a subquery within a condition and build subqueries via a manual and/or wizard method. After completing this unit, you will be able to: Define subqueries in predefined conditions Define @prompt syntaxes in predefined conditions

Subqueries in predefined conditions


End users may wish to see the most recent sale details, for example the most recent sale date and the revenue that was made on that date as a summary table in the document. In Web Intelligence Rich Client the end user can run a report with Sale Date and Sales Revenue, and apply a maximum for the Sale Date. However, as shown in the example below (containing a sample set of sale dates), the Sales Revenue that gets returned for the maximum date in the summary table is not the correct value.

The maximum Sale Date is the 31st of March 2005, and the Sales Revenue for that date is 17, 505. When adding a new table with =Max([Sale Date]) and another column with Sales Revenue, notice that the Sales Revenue showing for the maximum Sale Date is actually the total revenue for all sale dates. The correct results can be obtained by using a subquery at report level. However, instead of having the end user struggle with the appropriate subquery syntax, this can also be done at universe level as a predefined condition. For example:
SALE.SALE_DATE = ALL ( SELECT max(SALE.SALE_DATE) FROM SALE WHERE

60

Advanced Universe DesignLearners Guide

(SALE.SALE_TYPE='S') )

The example predefined condition syntax ensures that the result in Web Intelligence Rich Client appears correct. When the end user creates a new Web Intelligence Rich Client document using Sale Date and Sales Revenue in the Result Objects pane, and the new condition in the Query Filter pane, the end result shows the maximum Sale Date and the correct Sales Revenue value of 17,505.

The benefit of using this method is that it allows the end user to combine several objects in a report and get the correct maximum Sale Date and Sales Revenue values.

Using subqueries this way allows designers to use aggregate functions in the WHERE clause. It is also possible to extend this syntax and generate a condition that allows end users to retrieve the maximum Sale Date for each Client together with the corresponding Sales Revenue. In the Motors database there are a number of clients that have more than one sale date record.

Using a predefined condition with a subquery allows end users to return the maximum sale date per client. For example:
( CLIENT.CLIENT_ID=SALE.CLIENT_ID ) AND ( SALE.SALE_DATE = ALL ( SELECT max( SALE.SALE_DATE ) FROM SALE, CLIENT SubAlias__1 WHERE (SubAlias__1.CLIENT_ID=SALE.CLIENT_ID) AND (SALE.SALE_TYPE='S') AND SubAlias__1.CLIENT_LASTNAME + ', ' + SubAlias__1.CLIENT_FIRSTNAME = CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME ) )

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

61

Note: Universe Designer, uses SubAlias_1, and subsequent numbering, to replace the table names. When the end user creates a new Web Intelligence Rich Client document using Client Name, Sale Date and Sales Revenue in the Result Objects pane, and the new condition in the Query Filter pane, the end result shows the maximum Sale Date and the corresponding Sales Revenue value for each Client Name.

Activity: Creating subqueries in predefined conditions


Objective
Create new predefined conditions using subqueries

Instructions
1. Open your Motors universe file in Universe Designer. 2. Click the Filter icon at the bottom of the Universe pane. In the Sales Dates subclass, create a new Max Sales Date condition, and add an appropriate description. 3. The subquery to insert into the Where field is as follows:
SALE.SALE_DATE = ALL ( SELECT max(SALE.SALE_DATE) FROM SALE WHERE (SALE.SALE_TYPE='S') )

Note: The syntax for this subquery can be found on the course resources. 4. Click in the Filter icon at the bottom of the Universe pane. In the Sales Dates subclass, create a new Max Sales Date for each Client Name condition, and add an appropriate description. 5. The subquery to insert into the Where field is as follows:
( CLIENT.CLIENT_ID=SALE.CLIENT_ID ) AND ( SALE.SALE_DATE = ALL ( SELECT max( SALE.SALE_DATE ) FROM

62

Advanced Universe DesignLearners Guide

SALE, CLIENT SubAlias__1 WHERE (SubAlias__1.CLIENT_ID=SALE.CLIENT_ID) AND (SALE.SALE_TYPE='S') AND SubAlias__1.CLIENT_LASTNAME + ', ' + SubAlias__1.CLIENT_FIRSTNAME = CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME ) )

Note: The syntax for this subquery can be found on the course resources. 6. Ensure that the condition objects in the Sale Date sub class are incompatible with the tables used in aggregate awareness. 7. Save the changes in the universe. 8. Launch Web Intelligence Rich Client. Run a query with Sale Date and Sales Revenue in the Result Objects pane, and the new Max Sales Date in the Query Filter pane. The result now shows the maximum Sale Date and the correct Sales Revenue value of 17,505.

The benefit of using a subquery in a condition is that it allows the end user to combine several objects in a report and get the correct maximum Sale Date and Sales Revenue values. 9. Edit the query and add Invoice ID Number, Model and Showroom. The maximum date and corresponding measure and dimension values are correctly shown in the report:

10.In the Motors database there are a number of clients that have multiple sale date rows. Create a new document in Web Intelligence Rich Client, using Sale Date, Client Name and Sales Revenue in the Result Objects pane. Filter on the Client Name for Paul Brent, Howard Hugheston, Paul Penn, and John Smith.

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

63

11.Run a new query, using Sale Date, Client Name, and Sales Revenue in the Result Objects pane, and the new Max Sales Date for each Client Name condition in the Query Filter pane. The result now shows the maximum Sale Date and the correct Sales Revenue value per Client Name.

@Prompt scenarios in predefined conditions


In many cases prompts are needed to restrict the data or to make large value objects more user friendly to work with. For example, a prompt can be used to get an end user to select a value pattern, rather than having to look for the value in a long list. It is also possible to create an "All Values" option that allows end users to select values from the list or use the all values option.

To create an ALL Values prompt in a predefined condition


1. Open your universe file in Universe Designer. 2. Click the Filter icon at the bottom of the Universe pane. 3. The Universe pane changes to show the Condition Object View. 4. Click the class in which you wish the condition to appear. 5. Insert a new condition using the Insert Condition button on the toolbar, or by selecting Insert Condition. This opens the Edit Properties dialog box for condition objects. 6. In the Name field, enter a name for the condition object. 7. In the Description field, enter a help message for users describing the condition and any effect it has on queries they make. 8. Enter the condition directly in the Where field or via the Edit Where Clause box by selecting the >> button. 9. The syntax to insert is as follows:
TABLENAME.COLUMN_NAME IN @prompt('message','type','{Class\Object}',multi, free) OR ('*') IN @prompt('message','type','{Class\Object}',multi, free)

So how does this syntax work?

64

Advanced Universe DesignLearners Guide

When the user selects a value from the LOV or enters a value directly in the box, the first part of the condition is valid. The second part is not valid at this point. However, due to the use of the OR statement, the condition is valid if one of the two parts is valid. When the user enters an asterisk (*), the second part of the condition is valid. Due to the use of the OR statement, the condition is always valid (* = *) and all values are returned. 10.Click Parse. 11.Click OK. 12.Save the changes in the universe. 13.When using the new prompt condition in the Query Filter pane in a new report, it allows end users to select one or more values from the list or type * in the Type a value box. This returns all values of the object.

To create a predefined condition that returns a pattern selection


1. Open your universe file in Universe Designer. 2. Click the Filter icon at the bottom of the Universe pane. 3. The Universe pane changes to show the Condition Object View. 4. Click the class in which you wish the condition to appear. 5. Insert a new condition using the Insert Condition button on the toolbar, or by selecting Insert Condition. This opens the Edit Properties dialog box for condition objects. 6. In the Name field, enter a name for the condition object. 7. In the Description field, enter a help message for users describing the condition and any effect it has on queries they make. 8. Enter the condition directly in the Where field or via the Edit Where Clause box by selecting the >> button. 9. The syntax to insert is as follows:
((TABLENAME.COLUMN_NAME) LIKE (@prompt('message','type',,,)+'%')

10.Click Parse. 11.Click OK. 12.Save the changes in the universe. Note: Using LIKE as an operator does not work with a list of values. You can in theory get users to select one value or use the pattern, but in reality this does not work out very well in Web Intelligence Rich Client. It is best to ensure that there is no LOV referenced in the @prompt function syntax.

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

65

Activity: Using @prompt in predefined conditions


Objectives
Create a new predefined condition using an ALL values prompt Create a new predefined condition using a match pattern prompt

Create a new predefined condition using an ALL values prompt


1. In Universe Designer open your Motors universe file. 2. Click the Filter icon at the bottom of the Universe pane. 3. Insert a new condition in the Client class, called Client ALL values. In the Description field, enter a help message for users describing the condition and any effect it has on queries they make, for example: "Select one or more values from the
list, enter asterisk (*) to return all values."

4. Enter the condition directly in the Where field or via the Edit Where Clause box by selecting the >> button. The syntax to insert is as follows:
@select(Client\Client Name) IN @prompt('Select value or type * for all values' ,'A','Client\Client Name',multi,free) OR ('*') IN @prompt('Select value or type * for all values' ,'A','Client\Client Name',multi, free)

5. Click Parse, and OK. 6. Save changes and create a new Web Intelligence Rich Client report using Client Name and the new Client ALL values prompt filter. 7. In the Type a value box enter * and click the arrow. 8. Click Run Query. The report returns all Client Name values. 9. Edit the query and re-run. Remove the asterisk and test that the end user can also select multiple values from the LOV. Note: You may need to click on Refresh List if the values are not shown.

Create a new predefined condition using a match pattern prompt


1. In Universe Designer, create a new condition in the Client class, called Client Name Pattern Prompt. 2. In the Description field, enter a help message for users describing the condition and any effect it has on queries they make, for example:
This prompt allows you to:

Enter the first letter of the surname.

66

Advanced Universe DesignLearners Guide

Enter one or more starting letters followed by the % sign. Enter a pattern like: B%, J% 3. Enter the condition directly in the Where field or via the Edit Where Clause box by selecting the >> button. The syntax to insert is as follows:
@select(Client\Client Name) LIKE (@prompt('Enter a name pattern','A',,,)+'%')

4. Click Parse and OK. 5. Save the changes and create a new Web Intelligence Rich Client report using Region, Client Name, and the new Client Name Pattern Prompt condition. 6. In the prompt box enter B%, J%. 7. Click Run Query. The report returns all clients with a last name starting with "B" and a first name starting with "J".

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

67

Working with advanced LOVs


This unit explains different techniques for customizing your list of values. After completing this unit, you will be able to: Add an ALL values entry to an LOV Arrange LOVs using an A-Z index

Customizing LOVs
As shown in the predefined conditions unit you can create prompts that allows users to enter an asterisk (*) to return all values. You can also modify the LOV to show an "ALL values" entry. When selecting this it will also return the full list of values of the object.

To modify an LOV to have an ALL values entry


1. In Universe Designer, create a new object. Note: This object only serves as an ALL values object for use in an ALL values prompt syntax. 2. Use the following SELECT syntax for this object:
CASE WHEN TABLENAME.COLUMN_NAME = TABLENAME.COLUMN_NAME THEN 'ALL' ELSE TABLENAME.COLUMN_NAME END

The same TABLENAME.COLUMN_NAME is referenced in all sections of the CASE statement. This syntax converts each of the column values to a generic 'ALL' value. 3. Click the Properties tab. 4. Click Edit. 5. In the Query Panel select the Combine Queries toolbar icon. This generates a second query tab with the UNION symbol. 6. In the Query 2 tab, remove the newly created ALL values object and drag in the original object used in the ALL values prompt. 7. Click View SQL. The SQL shows the UNION between the ALL values object and the original prompt object.
SELECT Distinct CASE WHEN TABLENAME.COLUMN_NAME = TABLENAME.COLUMN_NAME THEN 'ALL' ELSE TABLENAME.COLUMN_NAME END FROM TABLENAME UNION SELECT Distinct TABLENAME.COLUMN_NAME FROM TABLENAME

8. Click OK to close the SQL Viewer.

68

Advanced Universe DesignLearners Guide

9. Click Run. 10.Click Display. The LOV contains a list of all individual column values and the value 'ALL'. 11.Click OK twice. 12.Click the Show or Hide Item toolbar icon to hide the ALL values object. 13.Click the Filter icon at the bottom of the Universe pane. 14.Open the previously created ALL values prompt condition. The original SQL syntax for this condition reads:
TABLENAME.COLUMN_NAME IN @prompt('message','type','{Class\Object}',multi, free) OR ('*') IN @prompt('message','type','{Class\Object}',multi, free)

15.The prompt syntax now needs to be altered to reference the LOV of the new ALL values object. Modify the syntax to:
TABLENAME.COLUMN_NAME IN @prompt('message','type','{Class\Object_ALL_Values}',multi, free) OR ('*') IN @prompt('message','type','{Class\Object_ALL_Values}',multi, free)

16.Append the following syntax to the modified condition:


OR ('ALL') IN @prompt('message','type','{Class\Object_ALL_Values}', multi, free)

This syntax ensures that when the 'ALL' value is selected in the LOV it has a 'reference' and the query returns all object values. When used in a query, the end user sees the value ALL as part of the LOV of the prompted object. Selecting this returns all values.

Activity: Modifying LOVs


Objectives
Create a Client ALL values object Modify the LOV for the Client ALL values predefined condition

Instructions
1. In Universe Designer, open your Motors universe file. 2. Create a new class called LOV Objects. 3. Create a new Client_ALL object in the LOV Objects class. 4. Click Apply.

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

69

5. Use the following SELECT syntax for the Client_ALL object:


CASE WHEN @select(Client\Client Name) = @select(Client\Client Name) THEN 'ALL' ELSE @select(Client\Client Name) END

This syntax converts all Client Name values to 'ALL'. 6. Click the Properties tab. 7. Click Edit. 8. In the Query Panel select the Combine Queries toolbar icon. This generates a second query tab with the UNION symbol. 9. In the Query 2 tab, remove the Client_ALL object and drag in the Client Name object instead. 10.Click View SQL. The SQL shows the UNION between the Client Name object and the Client_ALL object. Click OK to close the SQL Viewer. 11.Click Run. 12.Click Display. The LOV now contains a list of all individual client names and the value 'ALL'. 13.Click OK. 14.Select the Export with universe option. 15.Click OK. 16.Click the Show or Hide Item toolbar icon to hide the LOV Objects class. 17.Click the Filter icon at the bottom of the Universe pane. 18.Open the Client ALL values Prompt condition. 19.The prompt syntax now needs to reference the Client_ALL LOV. Modify the syntax to:
@select(Client\Client Name) IN @prompt('Select value or type * for all values','A','LOV Objects\Client_ALL',multi, free) OR ('*') IN @prompt('Select value or type * for all values' ,'A','LOV Objects\Client_ALL',multi, free)

20.Append the following syntax to the modified condition:


OR ('ALL') IN @prompt('Select value or type * for all values)','A','LOV Objects\Client_ALL',multi, free)

This syntax ensures that when the 'ALL' value is selected in the LOV it has a 'reference' and the query returns all client name values. The complete modified syntax should read:
@select(Client\Client Name) IN @prompt('Select value or type * for all values','A','LOV Objects\Client_ALL',multi, free) OR ('*') IN @prompt('Select value or type * for all values' ,'A','LOV Objects\Client_ALL',multi, free)

70

Advanced Universe DesignLearners Guide

OR ('ALL') IN @prompt('Select value or type * for all values)','A','LOV Objects\Client_ALL',multi, free)

21.Save the changes in your universe. 22.Launch Web Intelligence Rich Client. 23.Create a new report using Region and Client Name in the Result Objects pane, and the Client ALL values Prompt condition in the Query Filter pane. 24.Click Run Query. 25.The ALL value now shows up in the available list of values. Select the ALL value and click the arrow. 26.Run the query. This should return all client names. Note: This activity creates an extra object to bring in the ALL value. The UNION statement can also be added directly to the LOV with the Do not regenerate SQL before running option ticked.

Arranging LOV data as an A-Z index


Large LOVs can become difficult to navigate through for end users. Use an index to make the list smaller and easier to navigate.

In Universe Designer, an LOV can be viewed as tabular, or hierarchical. However, the hierarchical option is not available for Web Intelligence or Web Intelligence Rich Client end users. The same list hierarchy can be achieved in Web Intelligence or Web Intelligence Rich Client by using a cascading LOV.

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

71

To create an A-Z index in a cascading LOV


1. Open your universe file in Universe Designer. 2. Insert a new object using the Insert Object toolbar icon. 3. In the Select field use the following SELECT syntax:
substring(TABLENAME.COLUMN_NAME, 1, 1)

This syntax returns the first letter of the column. 4. Click OK. 5. Click the Show or hide item toolbar icon to hide the object. 6. Select Tools List of Values Create cascading list of values. 7. Add the first letter object to the cascading list of values menu, followed by the original object.

8. Verify that the Hierarchical View check box is selected. 9. Click Generate LOVs. As the selected objects may already contains LOVs, a message appears asking whether you want to overwrite the existing values. 10.Click OK. 11.Save the changes in the universe.

72

Advanced Universe DesignLearners Guide

Activity: Arranging LOVs


Objective
Create a cascading A-Z index LOV

Instructions
1. Create a new object called First Letter of Manager Lastname in the hidden LOV Objects class 2. In the Select field enter the following SELECT syntax:
substring(MANAGER.EMP_LASTNAME, 1, 1)

This syntax returns the first letter of the manager's last name. 3. Create a new cascading LOV. 4. Add the First Letter of Manager Lastname object to the cascading list of values menu, followed by the original Manager object. 5. Verify that the Hierarchical View check box is selected. 6. Generate the LOVs. 7. Ensure the LOV Objects class is hidden from the Aggregate awareness tables. 8. Save the changes and test the results in Web Intelligence Rich Client. 9. Return to Universe Designer and restore the Manager LOV using the following steps: Edit the Manager object and select the Properties tab. Click Edit. Remove the cascading LOV generated condition. Click Run to restore the LOV.

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

73

Working with advanced join syntaxes


This unit looks at prompts and conditional uses in joins, and how joins can be modified to accomplish relative date-time and running calculations in end user reports. After completing this unit, you will be able to: Define @prompt functions in joins Define conditional join paths Use conditional joins for relative date-time objects Use conditional joins to construct running sum objects

Defining @prompt functions in a join


Just as you can use prompts in object definitions and in predefined conditions you can define prompts in joins. If a prompt has to be applied to all objects for that table you can define a self-referencing join containing a prompt. Sometimes you want a prompt to limit the result set when joining two tables. For instance you want to prompt for selecting a calender range (begin date, end date prompt) when someone wants sales data through time.

By including objects in the query that cause the join to be included into the generated SQL you can test whether the prompt in the join definition appears and works correctly. Running the query causes the prompt of the join definition to pop up, just as it would for prompts in objects or predefined conditions. In the Motors universe, the Sale table contains rows for sales and rental data. Instead of using self-restricting joins to filter out the data, an @prompt syntax can be placed on the Sale table. This method could eliminate the requirement for aliases and additional contexts.

74

Advanced Universe DesignLearners Guide

Note: You cannot use the @select and @where functions in join definitions.

Defining conditional join paths


In some cases designers might want to define conditional joins. Some tables may have several identification categories keys for products. For example, a complex join can be defined between a Product table and the different levels of categories.

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

75

The prompt gets end users to select the category they need to query on and depending on the selection the CASE statement links the relevant joins. Note: The above example is not part of the Motors database schema.

Using joins to construct relative date-time objects


Relative date-time objects can be created using CASE statements and database date-time functions. Another way to construct relative date-time objects is to use a separate alias of the fact table and connect it to a time dimension table with a conditional join. The conditional join acts as the CASE statement. For example, an end user wants to create separate measures for the current and the previous years, but wants to link them to the same time period. The end user wants to display a table for January periods over a number of years.
Period This year Last Year

200701

161803

76

Advanced Universe DesignLearners Guide

200801 200901 201001 201101

314159 271803 141421 -

161803 314159 271803 141421

To achieve this, you need to link the data of 200701 to the month 200801 as the previous year's value, which can be done via a conditional join in the universe. In the Motors universe similar results can be achieved by using the Sale fact table, an alias of the Sale fact table, and the Finance_Period time dimension table. The conditional join is placed between the alias table and the Finance_Period table. The conditional join uses a database date function to extract the year, minus 1 to retrieve the previous year.

Data can, for example, be returned per quarter of the FY04-05 period and per quarter of the previous FY03-04 period.

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

77

The advantage of this solution is that it is an easier method to handle if you want to create a huge amount of measures for the previous year. Instead of creating several CASE objects, you just need to create the objects directly based on the new alias, and you only need to create one special join condition. The disadvantage of this method is that you need to have a date dimension table in the schema to make it work correctly. Secondly, by using this method, separate SQL queries need to be carried out which can cause performance issues.

Conditional joins and running calculations


Conditional joins can also be used to create running calculations. When using a fact table and a time dimension table you can create running sum and average calculations, however, the conditional join only works for clearly ordered time criteria.

78

Advanced Universe DesignLearners Guide

The disadvantage of this method is that users need to run these running calculation objects together with a time dimension to return the correct results. Secondly, the ">=" join has a negative impact on performance for big amounts of data. A real life database fact table normally contains several million rows of data, and internally the join creates a partial Cartesian product. Therefore, when having to deal with running calculation requirements, consider the following alternatives: Use analytic database functions (Transact_SQL). Note: These functions can also have a performance impact. Ask the ETL person to create extra columns for the running sums and pre-populate them. That saves a lot of complication and is much faster. Use report functionalities. At the end of the day, that is what functions like runningsum are designed for.

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

79

Activity: Using complex joins


Objectives
Create relative date-time calculations Create running calculations

Instructions: Create relative date-time calculations


1. In your Motors universe create a SALE_PREVIOUS_YEAR (SALE) alias table. Note: The self-restricting join for the SALE.SALE_TYPE column needs to be manually created for the alias table. 2. Join SALE_PREVIOUS_YEAR (SALE) to the FINANCE_PERIOD table.
dateadd(year,1,SALE_PREVIOUS_YEAR.SALE_DATE) between FINANCE_PERIOD.FP_START and FINANCE_PERIOD.FP_END

3. Set the appropriate cardinalities. 4. Join the SALE_PREVIOUS_YEAR (SALE) table to the CLIENT, SHOWROOM, and SALE_MODEL tables. Set the appropriate cardinalities. 5. Add a SALE_PREVIOUS_YEAR context. Tip: This context mirrors the existing SALES context. You can make a copy of the SALES context as follows: a. Open List Mode, and select the SALES context. b. Right-click the SALES context in the Context zone in List Mode. c. Select Insert Context. The New Context window appears, with all joins from the original SALES context selected. d. Name the context SALE_PREVIOUS_YEAR and remove all joins referring to the original SALE table:
CLIENT.CLIENT_ID = SALE.CLIENT_ID SHOWROOM.SHOWROOM_ID = SALE.SHOWROOM_ID SALE.SALE_ID = SALE_MODEL.SALE_ID SALE.SALE_TYPE = 'S' SALE.SALE_DATE between FINANCE.FP_START and FINANCE.FP_END

e. Replace the removed joins with the SALE_PREVIOUS_YEAR alias table joins. Ensure all newly created joins are included in the SALE_PREVIOUS_YEAR context. 6. In the Sales class, create a new Previous Year Sales Figures subclass. Insert the following objects: Sales Total this year:
sum(SALE.SALE_TOTAL)

Note: A Sales Total object, with the same SELECT syntax, already exists in the YTD Measure Objects class (subclass of Sales). Instead of creating a new object with the same

80

Advanced Universe DesignLearners Guide

syntax, you can create a new object in the Sales MAT subclass that references the existing Sales Total object using the @select function.
@select(YTD Measure Objects\Sales Total)

Sale Total previous year:


sum(SALE_PREVIOUS_YEAR.SALE_TOTAL)

7. Save your changes and test the new objects in Web Intelligence Rich Client. Your results should look similar to this example:

Instructions: Create running calculations


1. In your Motors universe create a SALE_RUNNING_SUM (SALE) alias table and a FINANCE_PERIOD_RUNNING_SUM (FINANCE_PERIOD) alias table. Note: The self-restricting join for the SALE.SALE_TYPE column needs to be manually created for the alias table. 2. Insert the following two joins:
SALE_RUNNING_SUM.SALE_DATE between FINANCE_PERIOD_RUNNING_SUM.FP_START and FINANCE_PERIOD_RUNNING_SUM.FP_END FINANCE_PERIOD.FP_YEAR = FINANCE_PERIOD_RUNNING_SUM.FP_YEAR and FINANCE_PERIOD.FP_MONTH >= FINANCE_PERIOD_RUNNING_SUM.FP_MONTH

3. Join the SALE_RUNNING_SUM (SALE) table to the CLIENT, SHOWROOM, and SALE_MODEL tables. 4. Set the appropriate cardinalities.

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

81

5. Add a RUNNING_SALES_FIGURES context, consisting of the three new joins only:


SALE_RUNNING_SUM.SALE_DATE between FINANCE_PERIOD_RUNNING_SUM.FP_START and FINANCE_PERIOD_RUNNING_SUM.FP_END FINANCE_PERIOD.FP_YEAR = FINANCE_PERIOD_RUNNING_SUM.FP_YEAR and FINANCE_PERIOD.FP_MONTH >= FINANCE_PERIOD_RUNNING_SUM.FP_MONTH SALE_RUNNING_SUM.SALE_TYPE='S' CLIENT.CLIENT_ID = SALE_RUNNING_SUM.CLIENT_ID SHOWROOM.SHOWROOM_ID = SALE_RUNNING_SUM.SHOWROOM_ID SALE_MODEL.SALE_ID = SALE_RUNNING_SUM.SALE_ID

6. In the Sales class, create a new Accumulating Sales Figures subclass. Insert the following objects: Sales Total:
sum(SALE.SALE_TOTAL)

Note: Either use the syntax shown above or use the @select function to reference the existing Sales Total object in the YTD Measure Objects class (subclass of Sales).
@select(YTD Measure Objects\Sales Total)

Sales Total Running Sum:


sum(SALE_RUNNING_SUM.SALE_TOTAL)

Month Number:
right(FINANCE_PERIOD.FP_MONTH,2)+0

Note: Either use the syntax shown above or use the @select function to reference the existing Financial Month object in the Finance Period class.
right(@select(Finance Period\Financial Month),2)+0

Sale Total Running Average:


sum(SALE_RUNNING_SUM.SALE_TOTAL/@select(Accumulating Sales Figures\Month Number))

7. Hide the Month Number object. 8. Save your changes and test the new objects in Web Intelligence Rich Client. Run a report with Financial Month, Sales Total, Sales Total Running Sum, and Sales Total Running Average. The Sales Total Running Sum column displays a cumulative aggregation of each Sales Total cell plus the previous period cell value, so the row at Month 02 displays the Sales Total of Month 01 + Sales Total of Month 02, the row at Month 03 displays the Sales Total of Month 01 + Sales Total of Month 02 + Sales Total of Month 03, and so on. The Sales Total Running Average column calculates a cumulative aggregation of each Sales Total cell plus the previous period cell value, divided by 2, 3, 4, and so on, depending on the number of cells added up. Your results should look similar to this example:

82

Advanced Universe DesignLearners Guide

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

83

Quiz: Creating complex predefined conditions and LOVs


1. True or false? Using subqueries allows you to use aggregate functions in the WHERE clause. 2. When setting up a predefined condition that returns a pattern, what two important syntaxes are required to achieve this? 3. What functions cannot be used in a join definition?

84

Advanced Universe DesignLearners Guide

Lesson summary
After completing this lesson, you are now able to: Create complex predefined conditions Work with advanced LOVs Work with advanced join syntaxes

Creating Complex Predefined Conditions, LOVs, and JoinsLearners Guide

85

86

Advanced Universe DesignLearners Guide

Lesson 5

Securing Universes
Lesson introduction
Different aspects of universe security can be managed at different levels: in the universe connection; in the Central Management Server (CMS); and directly at universe level. Universe level security, in the form of restriction sets, is covered in the BusinessObjects XI 3.0/3.1: Universe Design course. This lesson looks at security at connection and CMS level, combined with the use of universe restriction sets. After completing this lesson, you will be able to: Define connection and user credential parameters Work with Central Management Server (CMS) universe security Work with table mapping

Securing UniversesLearners Guide

87

Defining connection and user credential parameters


The universe connection determines how users connect to the data source and access the database. A number of connection options can be set up to either use an explicit database user account or delegate the authentication to user specific credentials. Universe designers can secure universes by setting different authentication options in the universe connection. This unit looks at these different options and parameters that can be set in a universe. After completing this unit, you will be able to: Describe the different data source credentials that can be applied in the connection

About security and universes


In BusinessObjects, universe security can be managed at these levels: Connection credentials and data source The universe connection determines how users connect to the data source and access the database. Universe designers can secure universes by setting different authentication options in the universe connection that corresponds back to security set at data source level. Central Management Server The BusinessObjects system administrator can authorize or deny access to universes stored in the CMS. The administrator can define which universes users are authorized to access, and depending on the rights defined for a user group, the administrator can also restrict viewing, editing, deleting, and other actions in a universe. Universe As universe designer, you can define restrictions for users who are authorized to use a universe. A group of restrictions that correspond to a user group is called a restriction set. A restriction set can include object access, row access, query and SQL generation controls, and connection controls. This unit describes the types of restriction sets you can define on a universe.

User credentials for the connection


In the connection Login Parameters there are three options that can be specified for passing user credential data through the universe connection.

Use specified user name and password: The user name and password for the data source authentication are used. Use Single Sign-On when refreshing reports at view time:

88

Advanced Universe DesignLearners Guide

When selected, the user name and password used to access the CMS are automatically used as database login parameters. Once users are logged onto BusinessObjects Enterprise, single sign-on to the database enables them to perform actions that require database access, for example, viewing and refreshing Web Intelligence documents without having to provide their logon credentials again. See the Business Objects Enterprise Administration guide for information on setting Single Sign-On (SSO). Use BusinessObjects credential mapping: The user is prompted for a database user password associated with their BusinessObjects account to refresh a report. This is set using the parameters dbuser and dbpass. These are set at the administrative level. Refer to Business Objects Enterprise Administrator's Guide for information on setting up this option. This option is used in a deployment where each Enterprise user is bound to a Database user to enforce Database security and monitoring on all users. When this option is selected for a connection, all users in the CMS that need to use this connection require having their database user credentials set in the CMS. Those credentials are known as dbuser and dbpass variables and can also be used with the @variable function.

Securing UniversesLearners Guide

89

Working with Central Management Server (CMS) universe security


The BusinessObjects system administrator can authorize or deny access to universes stored in the CMS. The administrator can define which universes users are authorized to access, and depending on the rights defined for a user group, the administrator can also restrict viewing, editing, deleting, and other actions in a universe. After completing this unit, you will be able to: Organize universes in secured folder structures

Organizing universes in secured folder structures


The Central Management Server (CMS) manages security information, such as user accounts, group memberships, and object rights that define user and group privileges. When users log on, the CMS coordinates the authentication process with security plug-ins; the CMS then grants the user a logon token and an active session on the system. The CMS also responds to authorization requests made by the rest of the system. When a user requests access to a universe in a particular folder, the CMS authorizes the request only after it verifies the user's account or group membership has sufficient privileges. The BusinessObjects system administrator can authorize or deny access to universes stored in the CMS. The administrator can define which universes users are authorized to access, and depending on the rights defined for a user group, the administrator can also restrict viewing, editing, deleting, and other actions in a universe. Note: For more information on the access levels for users and groups, consult the BusinessObjects Enterprise Administrator's Guide. Universes can be separated into folder or category structures instead, to provide a logical grouping of universes within one CMS. These folders can be created in Universe Designer or in the Central Management Console. Instead of denying access per universe file, you can group universes in folders and set appropriate access rights per folder. For example, you need an HR folder in which you have grouped universes that are only to be accessed by the HR group. Access to the HR universe folder can be set in the Central Management Console.

90

Advanced Universe DesignLearners Guide

Securing UniversesLearners Guide

91

Working with table mapping in restriction sets


As universe designer, you can define restrictions for users who are authorized to use a universe. A group of restrictions that correspond to a user group is called a restriction set. A restriction set can include object access, row access, query and SQL generation controls, and connection controls. These were covered in the BusinessObjects XI 3.0/3.1: Universe Design course. In addition you can use table mapping in a restriction set. This unit looks at how you can use table mapping to substitute one database table for another, and ensure that some users only have the right to see the substituted table values. After completing this unit, you will be able to: Apply table mapping in a restriction set

About restriction sets


Access restrictions that apply to a user or group are defined in a restriction set. You can define multiple restriction sets for a universe. Restriction sets can be edited, or deleted at any time. The following types of restrictions can be included in a restriction set:
Type of restriction Description

Connection

The universe connection to the data source. You can select an alternative connection for the universe. Options to limit the size of the result set and query execution time. Options to control the SQL generated for queries. You can apply column-level security. You can define a WHERE clause that restricts access to row and limits the result set returned by a query. You can replace a table referenced in the universe by another table in the database.

Query controls

SQL generation options

Object access

Row access

Alternative table access

92

Advanced Universe DesignLearners Guide

How are restriction sets managed?


In Universe Designer, you manage restriction sets using the Manage Access Restrictions dialog box, which you access by selecting the Manage Security option on the Tools menu.

The Available Restrictions pane in the left-hand side of the Manage Access Restrictions dialog box lists all the restriction sets currently available to the universe. The users and groups defined for each restriction set are listed in the Available Groups and Users pane, in the right-hand side of the dialog box. You can create, edit, and delete a restriction set at any time once the universe has been exported to the CMS. You can create multiple restrictions depending on the query needs of a target user group.

Working with table mapping


Table mapping is a security restriction feature that allows the universe to substitute one database table for another table when the SQL for an ad-hoc query is written. The table name in the SQL is replaced leaving all of the joins intact. For example, when an object requires data from the Annual_Figures table, you can apply a table mapping restriction to require specific users to obtain this data from another table, even a table from a different database such as the Annual_Figures_Euro from the MotorsEuro database. Here is the SQL created for a simple query using Showroom and Sales Revenue. The SQL uses the Annual_Figures table.
SELECT SHOWROOM.SHOWROOM_NAME, sum(ANNUAL_FIGURES.ANNUAL_SALE_VALUE) FROM SHOWROOM INNER JOIN ANNUAL_FIGURES ON (SHOWROOM.SHOWROOM_ID=ANNUAL_FIGURES.SHOWROOM_ID)

Securing UniversesLearners Guide

93

GROUP BY SHOWROOM.SHOWROOM_NAME

Here is the SQL created for the same simple query after a table mapping restriction has been applied. All references to the Annual_Figures table have been replaced with the Annual_Figures_Euro table.
SELECT SHOWROOM.SHOWROOM_NAME, sum(MotorsEURO.dbo.ANNUAL_FIGURES_EURO.ANNUAL_SALE_VALUE) FROM SHOWROOM INNER JOIN MotorsEURO.dbo.ANNUAL_FIGURES_EURO ON (SHOWROOM.SHOWROOM_ID=MotorsEURO.dbo.ANNUAL_FIGURES_EURO.SHOWROOM_ID) GROUP BY SHOWROOM.SHOWROOM_NAME

Note: All database tables in a universe must be on the same RDBMS platform. For example, you cannot include tables from a SQL Server database and an Oracle database in the same universe.

To map one table to another


1. From the Tools menu, select Manage security..., and then click Manage Access Restrictions... Note: If you have not yet exported the universe, a message box appears to indicate that you must export the universe before you can create security restrictions. 2. The Manage Access Restrictions box displays.

3. In the Manage Access Restrictions dialog box, click New.

94

Advanced Universe DesignLearners Guide

The Edit Restriction Set dialog box displays.

The six tabs in this dialog box allow you to define the type of restriction you want to include in this restriction set. Caution: The Reset button at the lower left corner resets every change made in any tab. It resets all options back to the defaults. 4. In the Restriction Name field, type the name you want to apply to the restriction. 5. In the Edit Restriction dialog box, click the Table Mapping tab.

Securing UniversesLearners Guide

95

The Table Mapping tab displays.

In this tab, you can define the replacement of a table referenced by an object in the universe by another table for a specific user or group of users. 6. Click Add in the Table Mapping tab. The New Table Mapping dialog box appears. 7. If you know the exact names of the tables, you can type them in the text boxes. Otherwise, use the Select button to select the original and replacement tables. 8. When you have selected the tables, click the Check All button to validate the status of the mapping settings. 9. If you have completed your restriction set, click OK to save the changes, otherwise navigate the remaining tabs to apply further restrictions.

Activity: Working with table mapping in a restriction set


Objectives
Create a new restriction set Apply the restriction set to a user group Test the restriction set in Web Intelligence Rich Client

Instructions
In this activity you insert tables from the MotorsEURO database, which contain data in Euros instead of US dollars.

96

Advanced Universe DesignLearners Guide

In addition you use the table mapping feature in a restriction set to substitute four tables from the Motors database with the new tables from the MotorsEURO database. 1. Arrange your structure to be able to add four additional tables. Launch the Table Browser and expand the MotorsEURO (and dbo) node.

2. Insert the following tables into your structure: ANNUAL_FIGURES_EURO QUARTER_FIGURES_EURO SALE_EURO MODEL_EURO Note: These tables remain in your structure as stand-alone tables. 3. Save your universe and export it to the location specified by the instructor. To be able to use the Manage Access Restrictions menu you need to export your universe. A CUID is assigned, when you export your universe, allowing you to apply security to your universe file. 4. Go to Tools Manage Security Manage Access Restrictions and create a table mapping restriction set called Sales_Euro. 5. In the Table Mapping tab click Add. 6. In the Original Table field select ANNUAL_FIGURES. In the Replacement Table field, select ANNUAL_FIGURES_EURO from the MotorsEURO database and click OK. Repeat the for the remaining MotorsEURO tables: QUARTER_FIGURES_EURO SALE_EURO MODEL_EURO 7. Select Check All and click OK. 8. Apply this restriction set to the sales user. Check with the instructor for the exact user name to use. 9. Preview the restriction to check that it is correct. 10.Save your universe and export it to the location specified by the instructor. 11.Log onto Web Intelligence Rich Client with the sales user account. Check with the instructor for the exact user name to use. 12.Create a new report based on your exported Motors universe. 13.Run a query with Client Name and Sales Revenue. 14.View the SQL.

Securing UniversesLearners Guide

97

The SALE and SALE_MODEL tables are replaced by the SALE_EURO and MODEL_EURO tables. 15.Run the report to view the results returned. The Sales Revenue data is in Euros. You can format the report to Euro currency in Web Intelligence Rich Client. 16.Run a query with Showroom and Sales Revenue. View the SQL. The ANNUAL_FIGURES table is replaced by the ANNUAL_FIGURES_EURO table.

98

Advanced Universe DesignLearners Guide

Quiz: Securing universes


1. Universe security can be managed at which levels? 2. True or False. Instead of denying access per universe file, you can group universes in folders and set appropriate access rights per folder. 3. True or False. When the Use Single Sign-On when refreshing reports at view time option is selected for a connection, all users in the CMS that need to use this connection will require having their database user credentials set in the CMS.

Securing UniversesLearners Guide

99

Lesson summary
After completing this lesson, you are now able to: Define connection and user credential parameters Work with Central Management Server (CMS) universe security Work with table mapping

100

Advanced Universe DesignLearners Guide

Lesson 6

Implementing Universe Life Cycle Management


Lesson introduction
This lesson describes how to move content from a development environment to a production environment. After completing this lesson, you will be able to: Move content from development to production

Implementing Universe Life Cycle ManagementLearners Guide

101

Moving content from development to production


After completing this unit, you will be able to: Describe life cycle management Use the Import Wizard Move content from a development environment to production

Life cycle management


Life cycle management promotes Business Intelligence (BI) content from development to quality assurance, and to production stages. Many deployments of BusinessObjects Enterprise contain different stages such as a development, quality assurance, and production within the same version. Reports and other Business Intelligence objects often require modification or enhancement as a result of changing information needs. Part of the life cycle management requirement is to be able to move different subsets of content at different times through a cycle. For example, a customer can have independent BI applications in a shared cluster system, potentially one for a Sales team and one for a HR team, that need to be successfully change-managed at different cycles from one another. The real challenge of moving content in a life cycle, is not the initial deployment of the code from development, quality assurance, and production, but to successfully manage subsequent updates to content. Content is inter-dependant on one another and you need to successfully impact all of the inter-dependant objects when going through a life cycle management. Administrators must control how BI objects are promoted through these stages, whether the objects are completely new or whether they overwrite or update objects that already exist in the destination environment.

Component Unique IDs


All objects have a unique ID, called a Component Unique ID (CUID). This ID retains the unique identity of objects during move, even between clusters. The assigned CUID remains with the object as it goes through life cycle management stages. A CUID: Possesses a unique ID in a cluster. Maintains a unique ID for each InfoObject. Note: Each BI object is stored in the CMS as an InfoObject. InfoObjects are system metadata objects that contain index information, and the actual documents or objects are stored in a file store. Permits object changes, location changes, and even name changes without breaking dependencies. For example, a report can be renamed, moved to a different folder, and can use a different locale setting that affects the names of the objects. None of these actions affects the assigned CUID.

102

Advanced Universe DesignLearners Guide

Also, if you modify the name and contents of several classes within a single universe that multiple reports are dependent on, you can move the changed universe into production together with all dependant reports.

Using the Import Wizard


BusinessObjects XI 3.0/3.1 imports most of the source environment using a single tool called the Import Wizard. The Import Wizard is a locally installed Windows application that allows you to import most objects in the repository (including user accounts, groups, folders, universes, documents, and objects stored in Inbox and personal folders on a cluster server) to the new BusinessObjects Enterprise system. The Import Wizard acts as a bridge between the source repository and target repository, or the CMS database. It can promote content between clusters on the same network (LAN or WAN). In addition to importing objects from previous versions to XI 3.0/3.1, the Import Wizard also enables you to manage the life cycle of a deployment by moving assets from one XI 3.0/3.1 deployment to another XI 3.0/3.1 deployment. This allows you to modify and enhance reports and other objects on a development environment, and then promote those objects to a production environment. The Import Wizard: Acts as a migration tool. Imports content from the source repository. Updates content (for example, universe IDs). Exports content to the target repository and physical storage area. The Import Wizard provides a series of screens that guide you through the process of importing and exporting Business Intelligence content such as user accounts, groups, folders, reports, universes, security, servers, and other objects. Various dialog boxes may appear depending on the source environment and the types of information that you choose to import. You can use the Import Wizard to import content from BusinessObjects, Crystal Enterprise, or BusinessObjects Enterprise into your current BusinessObjects Enterprise deployment. You can also export content from a BusinessObjects Enterprise XI 3.0/3.1 deployment to a Business Intelligence Archive Resource (BIAR) file, or import content from a BIAR file to your BusinessObjects Enterprise XI 3.0/3.1 deployment. An important consideration in life cycle management within the same version, is how the objects exist in the new environment. Are the promoted objects completely new objects in the new environment, or do the promoted objects overwrite similarly named objects in the new environment, or do the promoted objects simply update existing objects in the new environment? Import Wizard retains object links, original CUID and handles all dependencies, when you move from development to production. For example, if you select a set of three reports, the Import Wizard automatically searches for the interlinked dependencies, and includes all the subfolders the reports are in, the universe where they are based on and the universe connection.

Implementing Universe Life Cycle ManagementLearners Guide

103

In BusinessObjects Enterprise XI 3.0/3.1 there are new import scenario options, and a feature called incremental importing, which greatly enhance the administrators choices for content promotion.

Import scenarios
When using the Import Wizard to promote an object from one BusinessObjects Enterprise XI 3.0/3.1 deployment to another, the wizard allows you to use either the objects CUID or its name and path to determine whether the object already exists on the destination environment. It also lets you specify what you want the wizard to do when it finds that an object already exists on the destination environment.

When you are matching objects by CUID, and the Import Wizard finds a matching object on the destination environment, you have three options:
Scenario option Description

Update the destination. In case of name conflict, rename the object.

If the Import Wizard finds an object in the destination environment with the same CUID, it updates the destination's object. If the Import Wizard does not find an object in the destination environment with the same CUID, but it finds an object with the same

104

Advanced Universe DesignLearners Guide

Scenario option

Description

name, it imports the object from the source environment and then renames that object. If the Import Wizard finds an object in the destination environment with the same CUID, it updates the destination's object. If the Import Wizard finds an object on the destination environment with the same name but different CUID, it does not import the object from the source environment. If Import Wizard finds an object on the destination environment with the same CUID, it does not import the object.

Update the object. In case of name conflict, do not import it.

Do not import the object.

When you are matching objects by name and path, and the Import Wizard finds a matching object on the destination environment, you have three options:
Scenario option Description

Keep the destination object and import a renamed copy of the object.

If Import Wizard finds that an object already exists on the destination environment with the same name and path, it imports the source's object and renames it. If Import Wizard finds that an object already exists on the destination environment with the same name and path, it updates the destination environment's version with the source's. If Import Wizard finds that an object already exists on the destination environment with the same name and path, it does not import the source's version.

Update the destination object.

Do not import the object.

Note: Matching objects by name and path is not an option when importing content from a BIAR file. When you import from Business Intelligence Archive Resource (BIAR) files, objects are matched by CUID.

Implementing Universe Life Cycle ManagementLearners Guide

105

Incremental import
By default, the Import Wizard automatically imports dependent objects. For example, when you import report objects, the Import Wizard also imports the universes and universe connections that the reports use. If you are updating objects that already exist on the destination environment, the Incremental import screen appears. This screen prompts you to specify what type of objects and rights to want to overwrite on the destination environment with the objects from the source environment, when there is a match found. These options are safeguards that override what you selected on the Import scenarios screen. The Incremental import screen allows you to import objects without overwriting dependent objects that already exist on the destination environment. If you want to import report objects without importing a universe or connection that would overwrite a universe or connection on the destination environment, you can specify this on the Incremental import screen. Note: An object refers to any type of object except universes, universe connections, and groups.

106

Advanced Universe DesignLearners Guide

Universes and universe connections


When you import a universe the Import Wizard imports any associated connection objects. The connection is saved in the File Repository Server (FRS) and an InfoObject is created in the CMS. The universe and its linked documents are copied into the FRS. The Import Wizard has three modes for importing universes:
Mode What it does

Import all universes and all connection objects.

Imports all universes and all connection objects. You cannot select individual universes or connections. Imports all universes, and only connection objects used by those universes. Imports all universes and connections used by the selected documents. This option also enables you to select additional universes to import, even if they are not used by any document.

Import all universes and only connection objects used by these universes.

Import the universes and connections that the selected Web Intelligence and BusinessObjects documents use directly.

Implementing Universe Life Cycle ManagementLearners Guide

107

If you selected the third option, you are asked to choose which universes you want to move to production.

The eFashion and Island Resort Marketing check boxes are grayed out. The import wizard selected these two universes by default, as certain reports use it. Additional universes can be selected, or if you select a Web Intelligence document to import, the Import Wizard automatically selects the associated universes for import. If a universe is a derived universe, then all relevant core universes and their connections are also imported.

Working with Business Intelligence Archive Resource (BIAR) files


Using the Import Wizard, content can be moved directly from source CMS to destination CMS. You can also export content from a BusinessObjects Enterprise deployment to a Business Intelligence Archive Resource (BIAR) file. The Import Wizard lets you to backup your source CMS content to a Business Intelligence Archive Resource (BIAR) file, and then use that BIAR file to import this data into the destination server.

What is a BIAR file?


Business Intelligence Archive Resource (BIAR) files are a packaging tool for managed content in a BusinessObjects Enterprise system. They can be used to archive folders and objects in the Enterprise repository so that they can be easily transferred to a different location. This is useful for making a system backup, and moving BI applications from a development environment to a production environment.

108

Advanced Universe DesignLearners Guide

BIAR files can be used to export BI object content to XML for deployments without network access to the source repository. This can help customers that have stringent firewall requirements around their different development and production deployments, or customers that have separate geographic deployments that do not have connectivity between them. By using a BIAR file, there is no direct contact from one environment to another, and it can help efficiently propagate incremental moves from development to quality assurance, to production. Note: This requires additional steps to move between environments, and BIAR files can be large.

XML files
Essentially the BIAR file is a binary zip file that contains a collection of XML files for individual documents and universes. Every BIAR file has at least one single specific XML file (BusinessObjects.xml) that acts as the root deployment descriptor. This file tells the deployment engine in what order to deploy the object so that the dependency and security model can be deployed correctly. For example, connection objects must be created with the correct CUID before universes can refer to them, and universes must be deployed with the correct CUID before reports can reference them.

Version Control
Using the BIAR file method also provides a file based archive that can be placed in version, or source control system. Universes and reports have an individual XML file representation in the BIAR file, allowing for version control. For example, the content creator creates a set of reports and a universe that are tested in the development system. When the development tests are complete, the reports and universe are exported to a BIAR file. The tester that has direct access to the QA staging area checks in the BIAR file directly, or unzips the BIAR file to a specific folder structure. Note: A BIAR file is a standard zip file and can be unzipped accordingly; it acts similar to a WAR or JAR file. Individual documents and universes can be checked in and out of this structure in a granular fashion. Testers can change the label in the Version Control System to "ready for production" after testing, and the administrator can import the BIAR into the production area. This can be useful in an environment where deployment to quality assurance, to production is done by different people with different security rights, and where there is a requirement that code comes through a version control system prior to going into production. Using the BIAR file functionality in this way can provide an audit history of who changed what and when. Universes and report dependencies in the BIAR file can be granularly, and individually version controlled in your choice of Version Control Systems, for example Perforce, PVCS, or SourceSafe.

Implementing Universe Life Cycle ManagementLearners Guide

109

To export data to a BIAR file


1. Start the Import Wizard. Select Start Programs BusinessObjects XI 3.0/3.1 BusinessObjects Enterprise Import Wizard. 2. Specify the BusinessObjects Enterprise XI 3.0/3.1 system as the source environment. Enter the name of the CMS and user authentication. 3. Click Next. 4. Specify Business Intelligence Archive Resource (BIAR) File as the destination environment.

5. Type in the location and BIAR file name in the BIAR file box. Alternatively select the ellipse button to browse to a location, and enter the name of the BIAR file.

6. Click Next. 7. Specify the objects that you wish to copy from the test environment to production. By default all objects are selected. Each selected option is presented in a later wizard screen. For example, when you select "Import folders and objects" in this step, you are later able to refine your selection to just certain folders or reports. Note: When using a BIAR file as a destination, your selected options are stored into the file, and can be later imported into production. 8. Follow the wizard instructions, making the required selections, and click Next until the Ready to Import screen appears.

110

Advanced Universe DesignLearners Guide

9. The wizard provides a summary of the elements you intend to import to the BIAR file. If these settings appear correct, click Finish to generate the BIAR file. If your selections appear incorrect, click Back to modify your selections. The Import Progress screen appears. After the import is complete, the dialog box displays a summary of the import. 10.Click Done to close the Import Wizard.

To import data from a BIAR file into the destination CMS


1. Start the Import Wizard. Select Start Programs BusinessObjects XI 3.0/3.1 BusinessObjects Enterprise Import Wizard. 2. Specify Business Intelligence Archive Resource (BIAR) File as the source environment. Click the ellipse button to browse to the location of the BIAR file and click Open. 3. Click Next. 4. Specify the BusinessObjects Enterprise XI 3.0/3.1 system as the destination environment. Enter the name of the CMS and user authentication. 5. Click Next. 6. Specify the objects that you wish to copy from the test environment to production. Understand that the Import Wizard does not first read the contents of the BIAR file and then ask you the appropriate options. So, for example, if your BIAR file only contains one universe, you are still prompted to choose whether or not and which users you want to import. 7. Follow the wizard instructions, making the required selections, and click Next until the Ready to Import screen appears. 8. The wizard provides a summary of the elements you intend to import to the BIAR file. Click Finish. The Import Progress screen appears. After the import is complete, the dialog box displays a summary of the import. 9. Click Done to close the Import Wizard.

To promote universes and universe connections from a development environment to a production environment
This scenario describes promoting universe objects from one BusinessObjects Enterprise XI 3.0/3.1 deployment to another XI 3.0/3.1 deployment. By default, the Import Wizard imports any universe connections that the universes that you selected rely on. If you want to promote a universe to the destination, and do not want to overwrite the universe connection on the destination environment, ensure that you clear the Overwrite connection contents checkbox on the Incremental import screen.

Implementing Universe Life Cycle ManagementLearners Guide

111

1. Start the Import Wizard. Select Start Programs BusinessObjects XI 3.0/3.1 BusinessObjects Enterprise Import Wizard. 2. Specify the source and destination environments. 3. On the Select objects to import screen, select Import universes. 4. On the Import scenario screen, specify whether you want to match by CUID or name and path, and what you want the Import Wizard to do if it finds an object that already exists on the destination environment. 5. On the Increment import screen: a. If you want to update a universe that already exists on the destination environment, select the Overwrite universe contents check box. b. Specify whether you want to overwrite the universe connections on the destination. If you want to update universe connections that already exist on the destination environment, select the Overwrite connection contents check box. c. To ensure that you don't overwrite any objects or object rights, clear the Overwrite object contents and Overwrite object rights check boxes. d. If the Overwrite group and user membership check box appears, ensure that it is cleared. e. Click Next to continue. 6. On the Import options for universes and connections screen, select Import all universes and only connection objects used by these universes. 7. Complete the import process. The Import Wizard imports the universes that you selected to the destination environment. If you choose to not overwrite universes connections, the connections that the selected universes rely on are not imported, and the universe connections that exist on the destination environment are not touched. The relationships between the universes and the universe connections are maintained.

Using test folders


In previous versions of BusinessObjects, an administrator was able to create separate domains for development, quality assurance, and production. Domains could be located on different repository systems. The XI architecture no longer works with the concept of universe domains. Universes can be separated into folder or category structures instead, to provide a logical grouping of universes within one CMS. Folders are a lower-cost alternative to multiple CMS deployments, but using the folder structure method does have its limitations, and is not widely seen as a best practice. Lets take the following scenario. The Motors universe has been saved and exported to a development folder: \Development\Motors.unv. A number of reports have been created based on the Motors universe in the Development folder. When development of the Motors universe is complete, the designer moves the universe to production: \Production\Motors.unv.

112

Advanced Universe DesignLearners Guide

When a user accesses a report, the document looks for the correct data provider using a unique ID assigned to the universe. It looks for the universe initially stored in the Development folder. If the users do not have access to the Development folder, but do have access to the Production folder, then the universe from the Production folder is used. They can edit and refresh the report. It is important to ensure that the designer moves, not copies, the universe from development to production. Copying a universe provides it with its own CUID, and produces two different versions of the universe in production and development. Reports created against the development universe can not be refreshed against the production universe. The end user may receive an error message. Use test folders only if: It is not possible to implement multiple CMS environments. Security to universes is applied at folder level rather than per individual universe file.

Life cycle management recommendations


Recommended industry best practices are to use separate repositories and servers for development, quality assurance, and production systems. If you want to retain the CUIDs and have separation between development, quality assurance, and production, each have to use separate repositories. This is due to the rule that there can only be a single instance of an object with its CUID in a repository at one time. This way you cannot have development, quality assurance, and production in the same repository with the same CUID in different locations. Separate servers are also recommended as life cycle management is not only based on changes in the BI content, but also relates to changes in the O/S, security patches, and other server maintenance changes that have to be tested prior to going into production.

Implementing Universe Life Cycle ManagementLearners Guide

113

Use the BIAR file to move all, or incremental loads from one environment to another.

Activity: Moving content from development to production


Objective
Use test folders

Instructions
Create two new folders: Development and Production. Folders can be created directly in Universe Designer, as well as in the Central Management Console. In this activity the folders are created in Universe Designer. Create a Web Intelligence Rich Client report based on your Motors universe and explore what happens when the universe is moved and/or copied from the development folder to the production folder. 1. In Universe Designer go to File Import to import your Motors universe from the folder it was exported to in the last activity. 2. Click File Export. 3. In the Export Universe menu click Browse. 4. Right-click the folder specified by the instructor and select New Folder. Name the folder Development_xx, where "xx" stands for your initials. 5. Select your new Development folder and click OK twice to export your Motors universe to this new folder. As your universe was exported in the previous activity, a warning message appears. 6. Select Move to ensure there is only one version of your Motors universe. 7. Log into Web Intelligence Rich Client with the sales user. Check with the instructor for the exact user name to use. 8. Create a new Web Intelligence Rich Client document using your Motors universe from your Development folder. 9. Add the Client Name and Sales Revenue objects to the report. 10.Save the report locally as Dev_xx.wid file, where "xx" stands for your initials. 11.Log into Universe Designer with the login name used throughout the course (the same login name used in step 1), and import your Motors universe from your Development folder. 12. Click File Export. 13.In the Export Universe menu click Browse. 14.Right-click the folder specified by the instructor (same location used to create the Development_xx folder) and select New Folder. 15.Name the folder Production_xx, where "xx" stands for your initials.

114

Advanced Universe DesignLearners Guide

16.Export your universe to your new Production folder. A warning message appears. 17.Select Move to ensure there is still only one version of your Motors universe. 18.Log into Web Intelligence Rich Client with the sales user. Check with the instructor for the exact user name to use. Use the same user name that was used in step 5. 19.Open your Dev.wid file. Refresh the data, and verify that you can edit the query. Although your universe is in a new location the CUID has been retained and your report can refresh correctly. 20.Log into Universe Designer with the login name used throughout the course (the same login name used in step 1 and step 6), and export your universe to your Development folder. 21.Select the Copy option. The original version of your Motors universe file remains in your Production folder, and a copy of the same universe is created in your Development folder. 22.Import your Motors universe from your Production folder. 23. Click File Export. 24.In the Export Universe menu click Browse. 25.Export your Motors universe file (previously located in your Production folder) to the folder location specified by the instructor. Note: The location the original Motors universe is now exported and is not accessible to the sales user. 26.Log into Web Intelligence Rich Client with the sales user. Check with the instructor for the exact user name to use. Use the same user name that was used in step 5 and step 10. 27.Open your Dev.wid file. Refresh the data, and verify that you can edit the query. The copy of your universe in your Development folder has been given a new CUID. The report can not be refreshed against this universe, and the test sales user has no access to the other universe location.

Implementing Universe Life Cycle ManagementLearners Guide

115

Quiz: Implementing universe life cycle management


1. True or False. When importing documents from a BIAR file, both the universe name and path are used for finding dependent documents. 2. True or False. The Import Wizard acts as a bridge between the source repository and target repository, or the CMS database. It can promote content between clusters on the same network (LAN or WAN). 3. True or False. When using the Import Wizard to promote an object from one BusinessObjects Enterprise XI 3.0/3.1 deployment to another, the wizard allows you to use either the objects CUID or its name and path to determine whether the object already exists on the destination environment. It also lets you specify what you want the wizard to do when it finds that an object already exists on the destination environment.

116

Advanced Universe DesignLearners Guide

Lesson summary
After completing this lesson, you are now able to: Move content from development to production

Implementing Universe Life Cycle ManagementLearners Guide

117

118

Advanced Universe DesignLearners Guide

Lesson 7

Maintaining and Optimizing Universes


Lesson introduction
After you have completed the universe and then deployed it to the end-user population in your organization for report creation, you must maintain the universe to ensure that it continues to function correctly and provide the reports with accurate results. As a designer you can apply several parameters that are universe based or data access specific in order to maximize the potential of a universe. After completing this lesson, you will be able to: Optimize universes Apply foreign key index awareness Apply best practices for universe design

Maintaining and Optimizing UniversesLearners Guide

119

Optimizing universes
As a designer you can apply several parameters that are universe based or data access specific in order to maximize the potential of a universe. In the BusinessObjects XI 3.0/3.1: Universe Design course you looked at how you can set specific parameters when creating a new universe or via File Parameters menu. This unit looks at a more in depth insight into the parameters that can be set in the Universe Parameters Parameters menu, together with a look at other performance enhancing parameters that can be specified in the BusinessObjects product suite. Describe data access files and connection parameters Set up a trace file Use BusinessObjects dynamic SQL parameters

The Connection Server


Data access is managed by the Connection Server. The Connection Server is the Business Objects connection engine that creates and manages connections used by universes between Business Objects data access drivers and the target RDBMS middleware. The Connection Server libraries are present on the Web Intelligence Report Server, Desktop Intelligence Report Server, and Web Intelligence Job Server which allow these services to query the database directly without communicating with the Connection Server service. The Connection Server and the required data access components are automatically installed when you install BusinessObjects products. Data access drivers (<driver>.stg, <driver>.sbo, <driver>.prm, <driver>.cod) can be found in the installation directory:
C\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionsServer\<RDBMS>

Note: Refer to the BusinessObjects XI 3.0/3.1 Designer 's Guide and the for more information on the individual data access files (<driver>.stg, <driver>.sbo, <driver>.prm, <driver>.cod).

The CS.CFG file


Using the cs.cfg file you can set trace parameters that allow the recording of connection activity through the Connection Server in log files. The cs.cfg file is a data access general configuration file in XML format that contains default configuration parameters that apply to all data access drivers. The cs.cfg file is stored at the root level for the Connection Server:
C\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionsServer

120

Advanced Universe DesignLearners Guide

Note: The cs.cfg file is an XML file. The Document Type Definition (DTD) file that relates to each element used in the cs.cfg file is in the same directory. Ensure that, when editing and/or modifying the XML file, the cs.dtd is available.

Setting up a trace file


The BO_trace.ini file is the core trace file that defines how the trace is generated and which level is required. Thus, using this file is mandatory to get any trace files, including SQL traces. The BO_trace.ini file can be located in: C\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\scripts. For the purposes of generating the SQL trace, the BO_trace.ini file should consist of these parameters:
active = true; importance = '<<'; size = 10000; keep = true;

>> and >= does not capture any SELECT statements. == and <= does capture SELECT statements to data source only (universe connection). << captures everything, including SQL communication with the CMS.

To trace the full-client BusinessObjects products


Follow these steps to get a SQL trace from full-client BusinessObjects applications, like Universe Designer, Desktop Intelligence, and Web Intelligence Rich Client: 1. Set the System Environment variables. Go to Control Panel System Advanced Environment Variables and click on the New button to create a new system variable. You need to repeat this three times, once for each of the following variables: BO_TRACE_CONFIGDIR is the path of the folder containing the bo_trace.ini file BO_TRACE_CONFIGFILE is the complete path of the bo_trace.ini file BO_TRACE_LOGDIR is the path of the folder where the log files are saved For example:
Variable Name BO_TRACE_CONFIGDIR BO_TRACE_CONFIGFILE BO_TRACE_LOGDIR Variable Value C:\ C:\BO_trace.ini C:\

2. Open the cs.cfg file in an XML editor. The cs.cfg file is located in C\Program
Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionsServer.

Maintaining and Optimizing UniversesLearners Guide

121

3. Navigate to the <Traces> XML element and set <Traces ClassID="csTRACELOG" Active> equal to Yes. Note: You can specify a subset of access drivers that you want to trace. BusinessObjects allows you to filter the SQL statements according to the database type you want to trace. In the following example, Oracle, Teradata, and ODBC access drivers are traced:
<Traces ClassID="csTRACELOG" Active="Yes"> <Trace Name="MiddleWare" Active="Yes"> <Trace Name="Oracle" Active="Yes"/> <Trace Name="Sybase" Active="No"/> <Trace Name="Informix" Active="No"/> <Trace Name="Teradata" Active="Yes"/> <Trace Name="DB2" Active="No"/> <Trace Name="DB2/iSeries" Active="No"/> <Trace Name="ODBC2" Active="Yes"/> <Trace Name="ODBC3" Active="Yes"/> <Trace Name="OLEDB" Active="No"/> </Trace> </Traces>

4. Save the changes. Click Save. 5. Restart the services in the Central Configuration Manager (CCM). When now launching a BusinessObjects client module, you generate a log file that contains information regarding internal functions, and all of the SQL statements that are going to the database. The SQL statements are inserted into the client log file itself.

Connection configuration parameters


When creating or editing a new connection you can set certain parameters to optimize the connection against the database in use. Query time can often be shortened by optimizing a universe. The connection configuration page contains parameters used to optimize a universe: Defining the duration of a connection into a pool. Defining how BusinessObjects products respond when database resources are not available. Defining the size of the array fetch. You can set the following configuration parameters: Connection pool mode. Array fetch size. Array bind size. Login time-out.

Connection pool mode


There are three connection pool mode options:

122

Advanced Universe DesignLearners Guide

Pool mode option

Description

Disconnect after each transaction

Check this box if you want your connection to disconnect immediately after the transaction is completed. Users have to reconnect each time they want to access data. Check this box if you want your connection to stay active for a defined period of time. You must also enter a value for the number of minutes. This is the default Pool timeout value.

Keep the connection active for

Keep the connection active during the whole session (local mode only)

Check this box if you want your connection to stay active during the entire session of the product. The connection ends when the user exits the application.

Pool timeout

If you select Keep the pool active for in the previous field, this parameter specifies the length of time to keep the connection open.

Array fetch size


Specifies the maximum number of rows authorized with each fetch. If you enter 20, and your query retrieves 100 rows, the connection executes 5 fetches to retrieve your data. Five fetches of 20 rows each equals 100 rows of data. If you enter 1, the array fetch is deactivated and data is retrieved row by row. Note: Deactivating array fetch is the safest way of retrieving your data but row-by-row retrieval slows down server performance. The greater the value in the Array fetch size option, the faster your rows are retrieved; you must, however, ensure you have adequate client system memory. Note: If a query retrieves data containing blob or long text types, the array fetch is automatically reset to 1. The default value is 20.

Array bind size


Specifies the size of the bind array that the Connection Server uses before sending to the repository. The bind array is the area in memory where the Connection Server stores a batch of data to be loaded (sent to the repository). When the bind array fills, it is transmitted to the database. Generally, the larger the bind array, the more rows (n) can be loaded in one operation, and the better your performance.

Login time-out
Specifies the number of seconds that must be spent to establish a connection before an error message is displayed.

Maintaining and Optimizing UniversesLearners Guide

123

Custom connection parameters


You can also add custom connection parameters in the Custom Parameters menu. These parameters should only be modified by an advanced user, DBA, or BusinessObjects administrator. The Custom Parameters menu contains certain parameters that can be used to override connection settings. Parameters set in this menu are database specific. The following outlines a few parameters options that can be set: ConnectInit Hint

ConnectInit
This parameter is used to declare database specific session statements when the connection is established. These statements are not parsed and should therefore be carefully set. The syntax is defined in the universe Custom Parameters menu. An example Oracle database syntax is shown below:
ConnectInit ALTER SESSION SET CURRENT_SCHEMA = @variable('BOUSER')

It can also be used with Informix Dynamic Server to add SQL statements to a connection that are executed once the connection is opened. For example:
ConnectInit SET PDQPRIORITY HIGH

For Informix Dynamic Server, the PDQPRIORITY environment variable determines the degree of parallelism that the database server uses and affects how the database server allocates resources, including memory, processors, and disk reads.
ConnectInit = SET OPTIMIZATION FIRST ROWS

The ConnectInit parameter can be useful for: Auditing: Using the ConnectInit parameter, it is possible to send commands to the database when opening a session. This can be used to set database-specific parameters used for auditing purposes, as you can monitor the session_id and user that is accessing the universe. For example you can use a parameter like:
ConnectInit = Begin DBMS_SESSION.SET_IDENTIFYER('@variable('BOUSER')');COMMIT;END;

For auditing purposes, you can set the following variables: BO username: @variable('BOUSER') Universe name: @variable('UNVNAME') Document name: @variable('DOCNAME') Data provider name: @variable('DPNAME') Data provider type: @variable('DPTYPE')

Query Banding: Some Relational Database Management Systems (Teradata for example) can provide a query band (like banding a bird to track its flight path) with each query. The band can contain any

124

Advanced Universe DesignLearners Guide

number of attributes and values that provide detailed information about the query and may be referenced by workload management rules during the query classification phase. Query banding is especially valuable for applications that send work through pooled sessions, such as traditional session pool applications, analytic applications using pooled sessions, business intelligence (BI) tools and new Web service applications. You can use query banding to aqcuire information useful for workload management or tracking the use of the data warehouse. Setting session specific database parameters: Depending on the RDBMS used you can set session specific database parameters. For example, with Informix Dynamic Server, you can use the SET Database Object Mode statement to change the filtering mode of constraints of unique indexes, or to enable or disable constraints, indexes, and triggers. Enforcing Oracle Virtual Private Database: Oracle Virtual Private Database enforces security, to a fine level of granularity, directly on database tables, views, or synonyms. Because you attach security policies directly to these database objects, and the policies are automatically applied whenever a user accesses data, there is no way to bypass security. Using the ConnectInit parameter, you can specify the number of seconds that must be spent to establish a connection before an error message is displayed.

Hint (Oracle only)


A hint is commented information that is embedded in a query, and used by the Oracle optimizer to choose an execution plan. You should consult your Oracle documentation for full information on the Hints that can be used, and how they can be used to optimize queries. You enter the value for a Hint as a comment. A plus sign is used at the beginning, immediately after the comment delimiter, with no space between the comment delimiter and the plus sign:
/*+ <hint> */

Some useful hints that you can use are as follows. Consult your Oracle documentation for a full list:
Hint FIRST_ROWS What it does...

Optimizes response time. Use rule-based optimization and not cost. Performs a full table scan on the table. Scans table by rowid.

RULE

FULL

ROWID

Maintaining and Optimizing UniversesLearners Guide

125

Hint

What it does...

INDEX_FFS

Perform a fast full scan on the index rather than on the table.

An example of the FIRST_ROWS parameter is outlined below: 1. On the Custom Parameters page, click Hints. 2. Type /* + FIRST_ROWS */ in the values box, and click Finish. 3. The SQL generated in the client tool looks similar to this:
SELECT /* + FIRST_ROWS */ CLIENT.CLIENT_ID FROM CLIENT

Dynamic SQL parameters


Each data access driver is associated with a SQL parameters file (<driver>.prm). This PRM file contains default SQL parameters used for query generation, date and other operators, and functions. As the PRM file is associated with the data access driver, all parameters set in the <driver>.prm file affect all universes through their middleware connection. The PRM file is still used for many RDBMS specific SQL and connection parameters, however, SQL parameters common across RDBMS are now modified within an individual universe. These parameters apply only to the current universe, so universes using the same data access driver can have different SQL generation behavior. These dynamic SQL parameters are saved in the .unv file, and are accessible only from the universe. Note: Information on Dynamic SQL parameters can be found in the BusinessObjects XI 3.0/3.1: Designer's Guide, and in the Online Help option in Universe Designer.

To edit a dynamic SQL parameter


1. Open your universe in Universe Designer. 2. Select File Parameters Parameter from the toolbar menu. The Parameter dialog box opens showing the SQL parameters. 3. Select the appropriate parameter to edit. The selected parameter is displayed in the Property Name field together with the parameter default value in the Value field. 4. Change the value as required and click Replace to apply the changes. 5. Click OK to close the Parameter dialog box.

126

Advanced Universe DesignLearners Guide

Adapting dynamic SQL parameters


This section looks at some of the more common dynamic SQL parameters used and how changing their default values can influence the BusinessObjects interface and behavior. BEGIN_SQL END_SQL ANSI92 and FILTER_IN_FROM JOIN_BY_SQL

BEGIN_SQL
SQL statements can be prefixed with the BEGIN_SQL parameter. The BEGIN_SQL parameter can be configured to insert SQL orders that are executed before BusinessObjects-generated SQL statements. This ensures that the orders are executed before all generated SQL statements. This function works with any database that supports passing parameters before the SELECT statement. The following are some examples of use: Terradata: The BEGIN_SQL parameter can be used to monitor and manage database usage based on query origin details provided within the executed SQL. Oracle: The BEGIN_SQL parameter can be used to turn on read-only transactions. Netezza: The BEGIN_SQL parameter can be used to trigger optimization options.

END_SQL
The End_SQL parameter is used to append a string to the SQL sent to the database each time a query is run. This parameter is useful for query banding and auditing. DBAs often need to monitor query usage. The End_SQL parameter allows designers to input variables. By using a parameter like @variable('BOUSER'), the DBA can clearly see who sent the query with what results. This can aid system optimization, and can also be useful in a situation where a long running query must be terminated, or when the system has to be stopped for maintenance reasons. Variables that can be used are: BO username: @variable('BOUSER') Universe name: @variable('UNVNAME') Document name: @variable('DOCNAME') Data provider name: @variable('DPNAME') Data provider type: @variable('DPTYPE')

Maintaining and Optimizing UniversesLearners Guide

127

ANSI92 and FILTER_IN_FROM


If a query uses a condition object or a quick filter the selected values for this restriction are still displayed in the WHERE clause. In the example below a filter on Region is placed in the query, and the SQL is generated as:
SELECT CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, REGION.REGION_NAME, count(CLIENT.CLIENT_ID) FROM CLIENT INNER JOIN REGION ON (REGION.REGION_ID=CLIENT.REGION_ID) WHERE REGION.REGION_NAME In ('East','North') GROUP BY CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, REGION.REGION_NAME

The joins are generated in the FROM clause, but the REGION.REGION_NAME In ('East','North') restriction is placed in the WHERE clause. These types of WHERE clause restrictions can be moved to the FROM clause. This can be achieved be altering the setting for the FILTER_IN_FROM parameter. The FILTER_IN_FROM parameter determines if query conditions are included in the FROM clause. Note: This parameter only works in conjunction with the ANSI92 parameter, either as a dynamic SQL parameter, or set in the PRM file. As with the ANSI92 parameter, the FILTER_IN_FROM parameter has two settings: Yes, and No.

FILTER_IN_FROM: No
As seen in the above example, query filters are still generated in the WHERE clause instead of in the FROM clause:
SELECT CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, REGION.REGION_NAME, count(CLIENT.CLIENT_ID) FROM CLIENT INNER JOIN REGION ON (REGION.REGION_ID=CLIENT.REGION_ID) WHERE REGION.REGION_NAME In ('East','North') GROUP BY CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, REGION.REGION_NAME

When set to No, standard SQL is generated, or in case ANSI92 is set, the default ANSI92 SQL generation takes place. All joins are placed in the FROM clause, but any query filters and restrictions remain in the WHERE clause.

FILTER_IN_FROM: Yes
Setting the FILTER_IN_FROM parameter to Yes, moves the WHERE clause conditions seen in the previous section to the FROM clause.

128

Advanced Universe DesignLearners Guide

When the end user creates a new Web Intelligence Rich Client report using Client Name, Region, with a quick filter applied to Region, the generated SQL looks like this:

With the FILTER_IN_FROM parameter set to Yes, a query with Client Name, Region, and Sales Revenue produces the following SQL, with the Sale_Type = 'S' join restriction placed in the FROM clause:
SELECT CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, REGION.REGION_NAME, sum(SALE_MODEL.SALE_QTY * MODEL.MODEL_PRICE * ((100 SALE.SALE_DISCOUNT) / 100)) FROM MODEL INNER JOIN SALE_MODEL ON (SALE_MODEL.MODEL_ID=MODEL.MODEL_ID) INNER JOIN SALE ON (SALE.SALE_ID=SALE_MODEL.SALE_ID AND SALE.SALE_TYPE='S') INNER JOIN CLIENT ON (CLIENT.CLIENT_ID=SALE.CLIENT_ID) INNER JOIN REGION ON (REGION.REGION_ID=CLIENT.REGION_ID) GROUP BY CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, REGION.REGION_NAME)

Note: By changing the FILTER_IN_FROM parameter to Yes, this parameter is applied to the whole universe. The FILTER_IN_FROM functionality can however be applied to individual classes and objects.

About ANSI92 SQL syntax


The ANSI92 syntax moves join references from the WHERE clause to the FROM clause, which can help decrease the quantity of data parsed by the database. The SQL displays the table joins as INNER JOIN references in the FROM clause. For example:
SELECT CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, COUNTRY_REGION.COUNTRY_NAME,

Maintaining and Optimizing UniversesLearners Guide

129

count(CLIENT.CLIENT_ID) FROM CLIENT INNER JOIN COUNTRY COUNTRY_REGION ON (COUNTRY_REGION.COUNTRY_ID=CLIENT.COUNTRY_ID) GROUP BY CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, COUNTRY_REGION.COUNTRY_NAME

For databases that support ANSI92 SQL syntax, the ANSI92 parameter is automatically applied at data access driver (<driver>.prm) level. The PRM file contains the following parameter that is set to ANSI92:
<Parameter Name="OUTERJOINS_GENERATION">ANSI_92</Parameter>

As the PRM file is accessed via the connection, the ANSI92 setting is applied on all universes that access the same middleware connection. If you want to only apply ANSI92 syntax to selected universes, the option in the PRM file needs to be set to No:
<Parameter Name="OUTERJOINS_GENERATION">NO</Parameter>

The ANSI92 dynamic SQL parameter can instead be set to Yes directly in the universe.
Note: Remember that the PRM file is a system file and should be used/adapted responsibly. Ensure that a backup version is available to restore the defaults if changes have been applied.

The ANSI92 dynamic SQL parameter


The ANSI92 parameter allows ANSI92 SQL syntax to be used in query generation. It enables complete left, right, and full outer join support in the universe. The parameter has two possible setting: Yes, and No.

ANSI92: No
With the ANSI92 parameter set to No, SQL generation behaves according to the OUTER_JOIN_GENERATION parameter in the PRM file. If in the PRM file, the OUTER_JOIN_GENERATION parameter is set to No, standard SQL output is generated. The SQL output for a query using Client Name, Region, and Number of Clients is as follows:
SELECT CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, COUNTRY_REGION.COUNTRY_NAME, count(CLIENT.CLIENT_ID) FROM CLIENT, COUNTRY COUNTRY_REGION WHERE (COUNTRY_REGION.COUNTRY_ID=CLIENT.COUNTRY_ID) GROUP BY CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, COUNTRY_REGION.COUNTRY_NAME

ANSI92: Yes
By setting the ANSI92 parameter to Yes, join references are moved from the WHERE clause into the FROM clause, and the same query outputs the following SQL statement:
SELECT CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, COUNTRY_REGION.COUNTRY_NAME,

130

Advanced Universe DesignLearners Guide

count(CLIENT.CLIENT_ID) FROM CLIENT INNER JOIN COUNTRY COUNTRY_REGION ON (COUNTRY_REGION.COUNTRY_ID=CLIENT.COUNTRY_ID) GROUP BY CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, COUNTRY_REGION.COUNTRY_NAME

The structure now shows the join references in the FROM clause using INNER JOIN references.

Applying the FILTER_IN_FROM functionality to individual classes and objects


The FILTER_IN_FROM can be applied to individual classes and objects via each universe join. Note: In order to apply the FILTER_IN_FROM functionality to individual classes and objects, FILTER_IN_FROM dynamic SQL parameter needs to be set to No. When the ANSI92 parameter has been set to Yes, or when the PRM file has ANSI92 set as the default., the Advanced button in the Edit Join dialog box of each universe join becomes active.

In the Advanced Join Properties dialog box you can determine which classes and objects are included in the FROM clause in the generated SQL.

Maintaining and Optimizing UniversesLearners Guide

131

You can specify the following: Default behavior: When applied, all classes and objects that are associated with this join are greyed out and can not be selected. The standard ANSI92 rules are applied and if a quick filter is used in the query, the generated SQL displays the filter results in the WHERE clause. All objects in FROM: When applied, any condition/quick filter applied to the objects associated with this join are included in the FROM clause. Note: The classes and objects remain greyed out in the Advanced Join dialog box. No objects in FROM: When applied, all classes and objects that are associated with this join are greyed out and can not be selected. The standard ANSI92 rules are applied and if a quick filter is used in the query, the generated SQL displays the filter results in the WHERE clause. Selected objects in FROM: When applied, the classes and objects in the Advanced Join dialog box are activated. You can select the individual classes and objects. If a quick filter is applied to a selected object, the generated SQL displays the filter results for that object in the FROM clause. If a quick filter is applied to an object that was not selected, the generated SQL displays the filter results for that object in the WHERE clause.

To apply FILTER_IN_FROM functionality to individual classes and objects


1. Open your universe file in Universe Designer. 2. Select File Parameters Parameter. 3. Change the default value for the ANSI92 parameter to Yes. 4. Ensure the FILTER_IN_FROM parameter is set to No. 5. Double-click a join in the Structure pane. The Edit Join properties open for the selected join.

132

Advanced Universe DesignLearners Guide

6. Click the Advanced button. Note: This button is active only if the ANSI92 dynamic SQL parameter is set to Yes or when the PRM file has ANSI92 set as the default. The Advanced Join Properties dialog box opens.

Maintaining and Optimizing UniversesLearners Guide

133

7. Select the appropriate option from the behavior drop-down list.

8. Select the appropriate classes and objects.

134

Advanced Universe DesignLearners Guide

9. Click OK to apply the changes. 10.Repeat steps for other joins in the schema.

The JOIN_BY_SQL parameter


The JOIN_BY_SQL parameter combines split queries into one sentence and makes the database calculate the union. Split queries happen when requesting measures over multiple contexts. Each context generates one query and each query result set is sent back to the microcube. The microcube makes the final union and presents the data in the report as one result set. Each separate result set or SQL statement is processed sequentially by the RDBMS. This can slow down response time, especially if the requested query needs to process several SQL statements. The returned result sets subsequently need to be merged by the microcube into a final report result set. Example scenario: Using the Motors universe, if in a query you need information on car sales and rental revenue, it requires running across two contexts. The default behavior generates two separate queries for each context; sales and rentals. Assuming the query returns 10,000 rows of car sales information, and 10,000 rows of car rental information, this has double impact on the entire system sending a total of 20,000 rows of data across the network, and the Enterprise server synchronizes them to display 10,000 rows in your final report. Merging data this way has a high impact on the network and Enterprise server performance. Applying the JOIN_BY_SQL parameter moves the data UNION processing from the BusinessObjects Enterprise server to the RDBMS. Fewer rows travel the network and as the microcube no longer needs to merge the data, there is less impact on the BusinessObjects Enterprise server. Use of this parameter can improve performance depending on how well your RDBMS is set up. The JOIN_BY_SQL parameter can also help in taking advantage of the RDBMS ability to generate derived tables and the full outer join SQL. Despite generating at least two SQL flows, there is only one global SQL flow. Finally, this parameter can be used for universes through Crystal Reports. Multi-flow SQL cannot be applied for Crystal Reports. On some databases there is the possibility to force the generation of a single flow of SQL from the universe by setting the JOIN_BY_SQL = Yes.

JOIN_BY_SQL generated SQL


The generated SQL for the JOIN_BY_SQL functionality may differ depending on the RDBMS you are connecting to. The end result is the same. When the query is based on an Oracle data source, the SQL generated uses NVL to display the dimensions common to both sets of queries. The NVL function lets you substitute a value when a null value is encountered. The syntax for the NVL function is as follows:
NVL(string1, replace_with)

Where string1 is the string to test for a null value and replace_with is the value returned if string1 is null.

Maintaining and Optimizing UniversesLearners Guide

135

When the query is based on a MS SQL Server data source, the SQL generated uses COALESCE as NVL is not supported. The end result is the same. The COALESCE function returns the first non-null expression among its arguments. The syntax for COALESCE is:
COALESCE(expression [,...n])

Where expression is an expression of any type and n is a placeholder indicating that multiple expressions can be specified. All expressions must be the same type or must be implicitly convertible to the same type. If all arguments are NULL, COALESCE returns NULL. Note: The COALESCE syntax COALESCE(expression [,...n]) is equivalent to the following CASE statement:
CASE WHEN (expression IS NOT NULL) THEN expression1 ... WHEN (expression IS NOT NULL) THEN expressionN ELSE NULL

Activity: Using dynamic SQL parameters


Objectives
Apply the JOIN_BY_SQL parameter Apply the END_SQL parameter Apply the ANSI92 and FILTER_IN_FROM parameters

Instructions: Apply the JOIN_BY_SQL parameter


1. Create a new Web Intelligence Rich Client document based on your Motors universe. Drag the Client Name, Number of Clients, and Number of Cars Sold objects to the Result Objects pane. 2. Click View SQL to see the results. The query generates two statements. 3. Log out of Web Intelligence Rich Client. 4. Launch Universe Designer and open your Motors universe file. Note: The universe was exported in the previous lesson; select FileImport to import your universe. 5. Select File Parameters Parameter. The Parameter dialog box opens. 6. Locate the JOIN_BY_SQL parameter and change this to Yes. 7. Click Replace to apply the changes. 8. Click OK to close the Parameter dialog box. 9. Save the changes locally.

136

Advanced Universe DesignLearners Guide

10.Launch Web Intelligence Rich Client and create a new document based on your Motors universe. 11.Drag the Client Name, Sales Revenue, and Rental Revenue objects into the Result Objects pane. 12.Click View SQL to see the results. What has happened to the results? 13.Log out of Web Intelligence Rich Client.

Instructions: Apply the END_SQL parameter


1. With your Motors universe open in Universe Designer, select File Parameters Parameter. The Parameter dialog box opens. 2. Locate the END_SQL parameter. 3. In the Value box add the following syntax:
/*@variable('BOUSER'); @variable('UNVNAME'); @variable('DOCNAME'); @variable('DPNAME'); @variable('DPTYPE')*/

4. Click Replace. The parameter syntax for END_SQL is now modified. Note: The END_SQL parameter in the universe properties allows you to insert a string at the end of the SQL generated by a query. The variables are stated in a comment field and evaluated when running a query. The query is generated with the explicit sentence. 5. Click OK to close the Parameter dialog box. 6. Save your universe locally. 7. Test the results in Web Intelligence Rich Client. Run a query with Showroom and Sales Revenue. 8. Click the View SQL icon. The generated SQL appears in the SQL Viewer. The last line in the SQL contains the syntax added to the END_SQL parameter in the Parameter dialog box. 9. Run the query and return to the Query Panel by editing the query. 10.View the SQL. The END_SQL was executed at query run time. When viewing the SQL after running the query, you can see that the variable values are populated.

Instructions: Apply the ANSI92 and FILTER_IN_FROM parameters


1. , select FileParametersParameter and change the ANSI92 parameter to Yes. 2. With your Motors universe open in Universe Designer, select File Parameters Parameter. The Parameter dialog box opens. 3. Locate the ANSI92 parameter and change this to Yes.

Maintaining and Optimizing UniversesLearners Guide

137

4. Click Replace and then OK. 5. Double-click the join between the CLIENT and the REGION tables. 6. Click Advanced. 7. Choose the Selected objects in FROM option. 8. Select the Region and the Client Name objects only. Note: All detail objects below the Client Name are NOT selected. 9. Click OK twice. 10.Save your universe locally. 11.Create a new Web Intelligence Rich Client report with the Client Name and Region objects. Apply a Quick Filter on the Region object and select a few values from the list. 12.View the SQL. Is the Region object condition showing up in the FROM clause? 13.Remove the filter and apply a Quick Filter on the Client Name object and select a few values from the list. 14.View the SQL. Is the Client Name condition showing up in the FROM clause? 15.Remove the filter and drag in the Area Code detail object. 16.Apply a Quick Filter on the Region object and select the East Coast value. 17.Apply a second Quick Filter on the Area Code object and select the values 10011 and 10012. 18.View the SQL. What is happening with the WHERE and FROM clauses? Why is this happening? 19.Return to Universe Designer and open your Motors universe file. 20.Change the FILTER_IN_FROM parameter to Yes. Click Replace. 21.Click OK to close the Parameter dialog box. 22.Launch Web Intelligence Rich Client and create a new report with Client Name, Region, and Sales Revenue. Add a quick filter on Region, and select the values East and North. 23.Click View SQL to see the results. The SQL statement contains the INNER JOIN statements and there is no longer a WHERE clause generated. 24.Log out of Web Intelligence Rich Client. 25.Change all altered parameters in your universe back to their default settings (END_SQL, JOIN_BY_SQL, ANSI92, and FILTER_IN_FROM).

138

Advanced Universe DesignLearners Guide

Applying index awareness


The BusinessObjects XI 3.0/3.1: Universe Design course looked at applying primary key index. This unit further explores index awareness by setting foreign key awareness, and how Universe Designer takes advantage of primary and foreign keys that may already exist in the data source. After completing this unit, you will be able to: Understand foreign awareness Set up foreign key index awareness

What is index awareness?


Index awareness is the ability to take advantage of the indexes on key columns to speed data retrieval. The objects that you create in the universe are based on database columns that are meaningful to an end user. For example, a Customer object retrieves the field that contains the customer name. In this situation the customer table typically has a primary key (for example, an integer) that is not meaningful to the end user, but which is very important for database performance. In Universe Designer you can apply primary and foreign key index awareness: Primary key index awareness: by applying primary key index awareness on an object Universe Designer can substitute the object's column value with the associated index value. The generated query uses the key value instead of the actual column value. Foreign key index awareness: by applying foreign key index awareness on an object Universe Designer can restrict the values returned without the need to join the tables. If you build a query that involves filtering on a value in a dimension table, Universe Designer can apply the filter directly on the fact table by using the dimension table foreign key. This eliminates unnecessary and costly joins to dimension tables. When you set up index awareness in Universe Designer, you tell Universe Designer which database columns are primary and foreign keys. This can have a dramatic effect on query performance in the following ways: Universe Designer can take advantage of the indexes on key columns to speed data retrieval. Universe Designer can generate SQL that filters in the most efficient way. This is particularly important in a star schema database. If you build a query that involves filtering on a value in a dimension table, Universe Designer can apply the filter directly on the fact table by using the dimension table foreign key. This eliminates unnecessary and costly joins to dimension tables. Note: Universe Designer does not ignore duplicates with index awareness. If two customers have the same name, Universe Designer retrieves only one unless it is aware that each customer has a separate primary key.

Maintaining and Optimizing UniversesLearners Guide

139

For example, a query in Web Intelligence Rich Client, with Client Name in the Result Objects pane, and Client Country in the Query Filters pane, restricted on the countries United Kingdom and the United States, produces the following SQL when primary key index has been applied:
SELECT CLIENT.CLIENT_LASTNAME +', '+ CLIENT.CLIENT_FIRSTNAME, FROM CLIENT INNER JOIN REGION ON (CLIENT.REGION_ID=REGION.REGION_ID) INNER JOIN COUNTRY COUNTRY_REGION ON (COUNTRY_REGION.COUNTRY_ID=REGION.COUNTRY_ID) WHERE ( COUNTRY_REGION.COUNTRY_ID In ( 44,1 ) AND (COUNTRY_REGION.COUNTRY_ID=CLIENT.COUNTRY_ID) )

The restricted country name values have been replaced by their respective primary key index value to help increase query performance. Note: If the FILTER_IN_FROM parameter is also set for the universe, the index awareness condition appears in the FROM clause, instead of in the WHERE clause.

Avoiding joins in tables


With foreign key index awareness, you can tell Universe Designer that Country_ID is the primary key of the Country_Region table and that it also appears in the Client table as a foreign key. Using this information, Universe Designer can restrict the countries without joining to the Country_Region table. Reducing the number of joins in a query can help improve query performance. The SQL from the primary key index awareness example improved performance by restricting on the primary key (indexed) of the Country_Region table. The example query includes the Client and Country_Region tables, which both can provide the Country_ID column. The Country_Region table is only needed to satisfy the WHERE clause and is not needed in the SELECT or GROUP BY clauses. Using index awareness it is possible to remove the Country_Region table from the query completely, by telling BusinessObjects to use the Maker table to retrieve Country_ID data from. By defining the foreign key in the Client Country object, the same query returns the following SQL:
SELECT CLIENT.CLIENT_LASTNAME +', '+ CLIENT.CLIENT_FIRSTNAME, FROM CLIENT WHERE ( CLIENT.COUNTRY_ID In ( 44,1 ) )

The Country_Region table is no longer referenced in the SQL. This table no longer shows up in the FROM clause, nor in the WHERE clause as a join to the Client table or as a table used to retrieve the condition values from.

140

Advanced Universe DesignLearners Guide

To set up foreign key index awareness


1. Right-click the object on which you are setting up index awareness and select Object Properties from the shortcut menu. The Edit Properties dialog box displays. 2. Click the Keys tab. 3. Click Insert. A key line is inserted in the list of keys box. 4. To define key awareness for the foreign key: Select Foreign in the Key Type list. Click in the Select field and then click the ... button. In the Edit Select Statement dialog box, use the SQL Editor to build the foreign key SQL SELECT or type it directly. 5. Select Enable. 6. Repeat the steps for all columns in the foreign key and then click OK.

Multiple foreign key entries


The Keys tab allows more than one foreign key entry. This allows you to deal with repeated values in multiple tables (denormalized data). Database designers may denormalize primary key values beyond what is necessary to satisfy constraints or to assist in performance and simplification of SQL generation. It is expected to see an entity repeated twice: initially in the entitys own table as its primary key and then in a table that refers to this primary key through its foreign key. Denormalization implies that the database designer has gone beyond this duplication and has more than two instances of the value in a schema. In the Motors schema you can find such a scenario with the following tables: Client Region Country_Region All three tables contain a Country_ID column. If you set up the keys for the Client Country object, you can give BusinessObjects three choices from which it can retrieve these values for the purposes of restricting data in the WHERE clause. This can aid query performance.

Maintaining and Optimizing UniversesLearners Guide

141

When running a query in Web Intelligence Rich Client using Client Name and Region objects in the Result Objects pane, and the Client Country object in the Query Filters pane, the SQL generated is as follows:
SELECT CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, REGION.REGION_NAME FROM CLIENT INNER JOIN REGION ON (REGION.REGION_ID=CLIENT.REGION_ID) WHERE CLIENT.COUNTRY_ID In (1,44)

The Region table is used to restrict on Country_Region (Country_ID) as it is one of the foreign key entries and the Country_Region table is not used anywhere else in the query and is subsequently dropped from the SQL. Why does BusinessObjects use the Region table and not the Client table? Both tables exist in the FROM clause, however the Region table is used as the Country_ID key replacement. The reason for this is the order in which the foreign keys have been defined. The Country_ID key from the Region table was the last one defined in the list and this is the one that is used in the SQL generation. Rearranging the keys by placing the Country_ID key from the Client table last results in the following SQL instead:

SELECT CLIENT.CLIENT_LASTNAME + ', ' + CLIENT.CLIENT_FIRSTNAME, REGION.REGION_NAME FROM CLIENT INNER JOIN REGION ON (REGION.REGION_ID=CLIENT.REGION_ID) WHERE REGION.COUNTRY_ID In (1,44)

Note: If a shortcut join has been defined between the Country_Region and Client table, this shortcut key takes precedence as the foreign key, even if the last foreign key defined is the Region key.

142

Advanced Universe DesignLearners Guide

SQL Editor dialog box


The SQL Editor available to the management of index aware is the same SQL Editor dialog box available to predefined conditions, SELECT and WHERE clauses for objects. If your target database allows them, you can add SQL comments to the primary key and foreign key entries so that they are identifiable in the final query SQL for example:
/* Index Awareness Foreign Key */

To add a string value in the SQL Editor dialog box


1. Edit the object that has been made index aware and click the Keys tab. 2. Double-click the primary key select statement and append an appropriate string value. String values need to be appended by "/*" and closed with "*/" 3. Double-click the foreign key select statement and append an appropriate string value. String values need to be appended by "/*" and closed with "*/" 4. Click OK to apply your changes.

Using an index awareness WHERE clause


This section looks at using a WHERE clause for the primary and foreign key. Using a WHERE clause condition in either the primary or foreign key index acts as a data restriction. This may be useful if there is a large amount of data returned for a particular object.

To add a string value in the SQL Editor dialog box


1. Edit the object that has been made index aware and click the Keys tab. 2. Double-click the primary key select statement and append an appropriate string value. String values need to be appended by "/*" and closed with "*/" 3. Double-click the foreign key select statement and append an appropriate string value. String values need to be appended by "/*" and closed with "*/" 4. Click OK to apply your changes.

Maintaining and Optimizing UniversesLearners Guide

143

Applying best practices for universe design


As with any project you should always base your universe design and implementation on best practices. This unit summarizes some of the recommended guidelines for universe design. After completing this unit, you will be able to: Describe best practices for universe design Trace universe errors

Best practices for designing and optimizing your universe


The following section outlines a general workflow of best practices to design an effective universe that meets end users needs.

General best practices


Identify reporting requirements. Involve users at every step of the universe design and production process, especially in naming objects (this ensures the terminology is correct). Identify the database schema relevant to the universe you are creating and ensure there is representative data in that schema. Ensure that the data and structure of that schema is stable and not likely to change dramatically during development without warning. Insert universe tables one at a time, not in bulk, understanding how each table relates to rest of the universe. Insert joins and define cardinalities. Specify cardinalities manually as opposed to using the Detect Cardinalities option in Universe Designer. Always define cardinality, even for self-referencing and self-restricting joins, to avoid cardinality warning messages. Lay out your structure window with cardinalities facing the same direction and always arrange tables logically in the structure window. This helps you identify and visualize the context and resolve loops and SQL Traps. Add relevant comments to your universe to document up to date universe development changes. Remember that you may not be the only person building and designing this universe. In general, two methods are often used to place technical comments in the universe where they are not visible for the end user: Just type the text in the universe structure Place comments in SQL- boxes of objects between /* and */ in: Select and, Where fields, and in join definitions. Build relevant objects. Keep the universe business-focused, for example when naming objects and classes.

144

Advanced Universe DesignLearners Guide

Do not normalize. Use Multi-Dimensional Modeling instead. Always check integrity. If the universe is bigger than 1MB, divide it into multiple universes. Note: When you select File Open, you load the universe into RAM. If the universe is 1.39 MB, then it uses 1.5MB RAM. This could have an impact on the RAM available to your system. Use aggregate awareness, which speeds up query time by using special tables containing pre-calculated data. Do all aggregation on the server side instead of in the document (this can result in huge time savings). Define aggregate SQL functions on universe measures. Fewer rows get returned from the database thus making reports smaller and the calculation of variables, ranks and alerters quicker. Database connections for a universe should be set to disconnect after each transaction. This ensures that the SQL is terminated cleanly and that the are no treads left open to the database which are inactive. Note: A number of databases are licensed on the number of concurrent connections and if a connection is left open for a period of time when the keep connection active for x minutes is enabled, then end users could experience difficulties in accessing the database. Optimize universe performance and database tuning. Remove unnecessary lists of values, such as on dates and measure objects. Base lists of values on lookup tables. Add any other elements to the universe such as predefined conditions and hierarchies. Test the universe by building queries in BusinessObjects end user querying tools.

Best practices for classes and objects


Use the minimum possible objects in a universe. 500 objects is the recommended maximum. Too many objects may slow down the time required for a user to find objects. Create predefined condition or filter objects when possible. Consider putting the full class path and object name in the objects description. This may be a laborious process but one which is useful if you are working with a large universe. The description is shown in the report/query panel when a user points to an object. Always define help for objects. Start the help off with the objects full name: this is particularly helpful to users if the objects name is very long and cannot be fully displayed in the report/query panel. Dimension, measure, and detail objects should be within their logical classes unless the measure objects are generic to the whole universe, in which case a general measure class is created. Format objects and measures within the universe.

Maintaining and Optimizing UniversesLearners Guide

145

This prevents users having to spend valuable time formatting data from within the reporting tool every time they create a report.

Best practices for joins


Avoid building universe tables with no joins. There are exceptions, like with Views that act as summary tables, however in those instances ensure that incompatibilities are set using the Aggregate Navigation tool to avoid SQL errors. Optimize database performance by using shortcut joins. Shortcut joins provide an alternative path between two tables. Shortcut joins can improve query performance by using shorter paths and bypassing intermediate tables. Note: Placing shortcut joins in an existing universe may change the results returned by existing queries. Avoid outer joins where possible. Outer joins may have a negative effect on performance since more rows are returned. Additionally, some databases do not use indexes when outer joins are involved. Note: It is recommended that outer joins be placed at the end of the flow of data, otherwise outer join errors may occur. Potentially, this could cause the SQL to try to match on the equality of a NULL value, which it cannot do. Using aggregate aware and aliases may help if outer joins are necessary but cannot be placed at the end of the path. If you do place outer joins in the middle of a table path, the subsequent joins in the path may also have to be made outer to avoid errors. This can have a significant negative impact on performance.

146

Advanced Universe DesignLearners Guide

Quiz: Maintaining and optimizing universes


1. True or False. Adding new tables or columns to the database impacts the reports that are already created and refreshed regularly by end users. 2. True or False. In the case of a column name change, you only need to edit all the objects that referred to the original column. 3. True or False. Setting the FILTER_IN_FROM parameter to Yes moves the SELECT clause data of a query to the FROM clause.

Maintaining and Optimizing UniversesLearners Guide

147

Lesson summary
After completing this lesson, you are now able to: Optimize universes Apply foreign key index awareness Apply best practices for universe design

148

Advanced Universe DesignLearners Guide

Lesson 8

Creating Universes from Other Data Sources


Lesson introduction
The universe access list continues to grow as the variety of data sources evolve in customer environments. Using Universe Designer, you can create a universe from a data source, such as XML files or Oracle Analytic Workspaces, OLAP cubes, Stored Procedures, and JavaBeans. After completing this lesson, you will be able to: Create a universe from an XML metadata file Create stored procedure and JavaBeans universes Work with OLAP universes

Creating Universes from Other Data SourcesLearners Guide

149

Creating a universe from an XML data source


You can use Universe Designer to create a universe from a XML data source, by using the Metadata Exchange panel. Once the universe has been created it can be exported to the Central Management Server (CMS) as any other universe, and is then available to end users to run queries and create reports on. Note: The Metadata Exchange wizard is also available in stand-alone mode. To access the Metadata Exchange panel in stand-alone mode launch Universe Builder via Start Programs BusinessObjects XI 3.0/3.1 BusinessObjects Enterprise Universe Builder. After completing this unit, you will be able to: List the data sources you can use with the Metadata Exchange panel Describe the Metadata Exchange panel functions Create a new universe from an XML data source

Which data sources are supported in the Metadata Exchange panel?


Using the Metadata Exchange panel, you can create universes from the following data sources: XML data sources: Common Warehouse Model (CWM Relational 1.0) Common Warehouse Model OLAP (CWM OLAP) Oracle Warehouse Builder (Oracle WB) Data Integrator IBM DB2 Data Warehouse Center (IBM DB2 DWC) IBM DB2 Cube Views Oracle Analytic Workspaces (Oracle OLAP)

Working with the Metadata Exchange panel


You access the Metadata Exchange panel by selecting the Metadata Exchange option from the File menu in Universe Designer.

150

Advanced Universe DesignLearners Guide

In the Metadata Exchange panel, you can: Select the data source format to build the universe. This is the source XML file or database view that you use to build a universe. A universe creation wizard takes you through steps to select a connection for the data source, selecting the data components that you want to be mapped to the universe, and finally the generation of the universe. Update an existing universe with data from a data source that has been updated. This is the data source that has been used to create the universe. The source has been updated, and now you want to update the universe with the same modification. A universe update wizard takes you through the steps needed to update the universe. Export a universe to a data source format. You select a data source format to which you can export the universe. The default option available is DB2 Cube Views 8.1, then save the universe in that format. The Metadata Exchange panel takes you through a three-step process to create the universe: Specify the location of the data source file. Select the tables you want to include in the universe. Define the connection to the original data source.

To create a universe from a CWM Relational 1.0/1.1 metadata file


1. From the File menu in Universe Designer, select Metadata Exchange. The Metadata Exchange panel displays. 2. In the Metadata Exchange panel, click the drop-down arrow next to the Create a universe from the drop-down list.

Creating Universes from Other Data SourcesLearners Guide

151

3. Select the CWM Relational 1.0/1.1 Metadata format. 4. Click OK. 5. The CWM Relational 1.0 Universe Builder wizard appears. 6. Click Next to continue. 7. In the Universe creation - Step 1/5 wizard page, browse to the location of your XML metadata file.

8. Click Next to continue. The Universe creation - Step 2/5 wizard page displays:

152

Advanced Universe DesignLearners Guide

9. Select Database1 to highlight it and click Next. The Universe creation - Step 3/5 wizard page displays.

This wizard page displays all the tables and columns in this metadata file. 10.Click the + box next to a table to view the columns in this table. 11.You can select individual tables or columns in the list and use the > button to move them individually into the list in the right-hand side of the wizard box. Or you can use the >> button to move all the contents of the file at once. 12.Click Next to continue. The Universe creation - Step 4/5 wizard page displays. The Universe creation - Step 4/5 wizard page allows you to select the connection the universe uses to connect to the data source. For the purposes of this course, you will not actually connect the universe to a data source, so it is not important which connection is selected here. 13.Type a name for the new universe in the Universe name field. The universe name must be eight characters or less. 14.Select the Advanced button. The Options dialog box displays. In the General tab of the Options dialog box, you can specify the location where trace files can be stored. 15.Click the File Locations tab.

Creating Universes from Other Data SourcesLearners Guide

153

The File Locations tab allows you to specify default locations for storing the source XML files and the parameter files associated with the metadata. 16.Click OK to close the Options dialog box. Click Next to continue The Universe creation - Step 5/5 wizard page appears. This page summarizes the connection and file information that are used to create the universe. 17.Click Finish. The universe displays with classes, objects, and joins automatically defined:

Note: You cannot actually check the integrity of this universe, or export the universe to the CMS, because you have not defined a connection to the original data source. 18.Save the universe and close Universe Designer.

154

Advanced Universe DesignLearners Guide

Creating stored procedure and JavaBeans universes


The objective of universes is to provide a seamless access to any underlying source, which then ensures a consistent experience to users. By doing so, users can query, analyze, and report on any data source using universes. The universe access list continues to grow as the variety of data sources evolve in our customer environments; the universe's capabilities are extended to access relational SQL stored procedures and JavaBeans. This unit looks at creating universes using stored procedures and JavaBeans. After completing this unit, you will be able to: Create a universe using a stored procedure Create a universe using JavaBeans

Stored procedure universes


A stored procedure universe is a special universe that enables Web Intelligence users to access stored procedures residing in the database. This is the only way that Web Intelligence users can access stored procedures. Web Intelligence users can use the stored procedure universes to create reports that are based on stored procedures in the database. A stored procedure is a compiled SQL program, consisting of one or more SQL statements, which resides and runs on the target database.

Creating a universe based on stored procedures


Universe Designer allows designers to create universes based on stored procedures. This feature is very important for customers who have historically used Desktop Intelligence for their reporting needs and are now interested in migrating to Web Intelligence. Support of stored procedures brings Web Intelligence closer to parity with Desktop Intelligence functionality. BusinessObjects supports stored procedures: Without parameters. With parameters (IN). With multi-result sets. With multi-statement (with SQL sentences different from SELECT). Stored procedures are represented as Derived Tables, thus they benefit from Derived Table mechanisms and concepts. Note: It is important to note that you must create a new universe based on the stored procedure. Note: Universes that have been created from stored procedures are supported in Web Intelligence, Query as a Web Service, Polestar, and Live Office.

Creating Universes from Other Data SourcesLearners Guide

155

To create a universe based on a simple stored procedure


You can create a universe based on one or several stored procedures without parameters. 1. In Universe Designer, click the Quick Design Wizard button on the toolbar. The Welcome dialog box appears. 2. Click the Click here to choose stored procedures universe check box at the bottom of the pane. 3. Click Begin. The Define the Universe Parameter dialog box appears. 4. Type in a universe name in the Enter the universe name field. 5. Choose the database connection from the Select the database connection list or click New to create a new connection. 6. Click Next. The Create initial classes and objects dialog box appears. 7. Expand the database node and the database owner node (for example dbo) to select a stored procedure. 8. Click Add. The stored procedure is created in the Universe pane. 9. Click Next. 10.Click Finish. The Congratulations dialog box appears.

Stored procedure parameters in the universe


To improve performance, you can have several stored procedures based on the same universe for the same data source (via the Quick Design Wizard or Insert Stored procedures Update ). In Universe Parameters, check the parameter STORED_PROC_UNIVERSE is set to Yes. This indicates that the current universe is based on a stored procedure. In order to avoid parsing errors on stored procedures columns, it is recommended that you alias result columns based on complex SQL, for example using the aggregate functions - sum, count. The creation of aliased objects cannot be constrained. Note: The stored procedures do not support OUT or dynamic result sets parameters.

To create a universe based on stored procedures with input parameters


You already have objects declared if the procedure prompts the user to select a value from a list in the database.

156

Advanced Universe DesignLearners Guide

You can create a universe based on stored procedures that requires one or more input parameters. Depending on the entered value, the procedure returns the fact data of the value from the appropriate fact table. 1. In Universe Designer, click the Quick Design Wizard button on the toolbar. The Welcome dialog box appears. 2. Click the Click here to choose stored procedures universe check box at the bottom of the dialog box. 3. Click Begin. The Define the Universe Parameter panel appears. 4. Type in a universe name in the Enter the universe name field. 5. Choose the database connection from the Select the database connection list or click New to create a new connection. 6. Click Next. The Create initial classes and objects panel appears. 7. Expand the database node and the database owner node (for example dbo) to select a stored procedure. 8. Click Add. When the stored procedure requires input parameters, the Stored Procedures Editor appears. 9. Select a parameter from the list of parameters. 10.Enter a value for the parameter in the Value field or type in a prompt. 11.Select Use this value or Prompt me for a value. When you enter a value, and when the procedure is executed, the parameter retrieves the columns and the result set structure. This value is passed on to the procedure. 12.If you have selected Prompt me for a value, type in the prompt. You can enter a prompt message or browse to select an existing object (for example, list of subscriber IDs from a table). 13.Click OK. 14.Click Next. 15.Click Finish. The Congratulations dialog box appears.

Advantages and disadvantages of stored procedure universes


Stored procedures offer the following benefits: They encapsulate code. The database operation appears once, in the stored procedure, and not multiple times throughout the application source. This improves debugging as well as maintainability.

Creating Universes from Other Data SourcesLearners Guide

157

Changes to the database schema affect the source code in only one place, the stored procedure. Any schema changes become a database administration task rather than code revision. Since the stored procedures reside on the server, you can set tighter security restrictions. This saves more trusted permissions for the well-protected stored procedure themselves. Because stored procedures are compiled and stored outside the client application, they can use more sensitive variables within the SQL syntax, such as passwords or personal data. Using stored procedures reduces network traffic. The stored procedure universe feature is useful for customers who already have many programs that cannot be duplicated easily in straight SQL. If the customer is designing a new project, it's better to build a universe or simply add a derived table to an existing universe. Note the following restrictions apply to stored procedures universes: No joins are permitted between objects in stored procedures universes. Filters cannot be used on the stored procedure universe. You cannot link a stored procedure universe to a standard universe. Not all RDBMSs support stored procedures. Consult your database guide to see if yours does. COMPUTE, PRINT, OUTPUT, or STATUS statements contained in stored procedures are not executed. If the stored procedure uses input parameters, they are converted as prompts in a Web Intelligence document. If you want to link the stored procedure to a list of values, you need to create an additional object in the universe to house the LOVs returned.

JavaBeans and universes


JavaBeans are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object (the bean), so that the bean can be passed around rather than the individual objects. A JavaBean can be developed to obtain a result set from any source, and we support beans that implement at least one Sql.ResultSet method.

Using a JavaBean universe


Universe Designer supports the creation of a universe based on JavaBeans. The bean allows BusinessObjects designers to build a universe from a bean that implements at least one Java.Sql.ResultSet method. The universe based on JavaBeans returns a result set from which you build a universe entity-relation. The universe based on JavaBeans uses the same workflow and offers the same benefits as a universe based on stored procedures. The limitations are also the same: No joins are permitted. Filters cannot be used on the universe. Developers can create JavaBeans that you can use as data sources. You can create connections using these JavaBeans. Typically, these JavaBeans provide access to a datasource. In order to create a JavaBeans connection, the developers who create the JavaBean need to supply:

158

Advanced Universe DesignLearners Guide

The required .jar files. Any other files that the JavaBean requires. Any specific configuration details that the JavaBeans driver requires. Within a JavaBeans driver, data-retrieval procedures are configured as stored procedures. When configuring a JavaBeans connection, on the Database Middleware Selection screen, of the New Connection Wizard you must select the Filter Stored Procedures Network Layers check-box. If you do not, the New Connection Wizard does not display the JavaBeans drivers that are available.

To create a JavaBean connection


1. Use an XML editor to open the javabeans.sbo file for editing. For example, on a Windows system, the configuration files are located in the following paths, where $INSTALLDIR is the directory where the BusinessObjects applications are installed: \\<INSTALDIR>\win32_x86\dataAccess\connectionServer\javabean. 2. Add the required .jar file details to the ClassPath area. Include the fully qualified path names when specifying these files. Note: These files need to be installed on the machine running the BusinessObjects application. JavaBean SBO example file structure:
<DataBase Active="Yes" Name="Excel Spreadsheet"> <JavaBean> <ClassPath> <Path>$ROOT$/beans/bean_excel.jar </Path> </ClassPath> <Parameter Name="JavaBean Class">com .businessobjects.beans.excel.Excel

Creating Universes from Other Data SourcesLearners Guide

159

</Parameter> <Parameter Name="URL Format">$DATASOURCE$ </Parameter> </JavaBean> <Parameter Name="Family">Java Beans </Parameter> <Parameter Name="Description File"> bean_excel</Parameter> <Parameter Name="Authentication Mode"> Bypass</Parameter> <Parameter Name="Extensions">bean_excel, javabean</Parameter> </DataBase> </DataBases>

3. Save and close the javabeans.sbo file. 4. Perform any other configuration tasks specified by the JavaBeans developer. 5. Run the Connection Wizard. The JavaBeans datasource that you have configured should appear in the list of available connections. Select the JavaBeans datasource and use the Wizard to configure the connection. When you complete this task, the connection is available for use with a BusinessObjects application.

Activity: Creating stored procedure universes


Objective
Create universes from stored procedures.

Instructions
There are two stored procedures available in the Motors database: TenMostExpensiveModels

CustomerOrderHistory

160

Advanced Universe DesignLearners Guide

Tip: The CustomerOrderHistory stored procedure contains an input parameter for the Client ID 1001. 1. Using the TenMostExpensiveModels stored procedure, create a new universe called SimpleSP_xx (where "xx" stands for your initials). Use your MotorsOLEDB_xx (where "xx" stands for your initials) connection to connect to the Motors database. 2. Using the CustomerOrderHistory stored procedure, create a new universe called ParamSP_xx (where "xx" stands for your initials). Use your MotorsOLEDB_xx (where "xx" stands for your initials) connection to connect to the Motors database. 3. Save your universes locally and test them in Web Intelligence Rich Client.

Creating Universes from Other Data SourcesLearners Guide

161

Working with OLAP universes


An OLAP universe is a BusinessObjects universe that has been generated from an OLAP cube or query. The universe is created automatically from a selected connection to an OLAP data source using an OLAP query flattening driver that is installed as an add in to Universe Designer. Once the universe has been created it can be exported to the Central Management System (CMS) as any other universe, and is then available to Web Intelligence users to run queries and create reports. After completing this unit, you will be able to: Describe what an OLAP cube is Create and maintain an OLAP universe

Understanding the OLAP cube


On Line Analytical Processing, or OLAP allows end users to get concise answers to business questions such as: "Show me the sales generated during a specified period, for a specified product in a specified location less than a specified amount".

Using OLAP, a user can quickly narrow or expand the scope of a business question. For example, in the scenario illustrated above, the sales for a single product, a group of products, or many products can be displayed. In a traditional relational reporting system, each of these questions would require a separate relational query to summarize historical data which, when the volume of transactions is high, can take a long time to produce the desired results. By comparison, comparable queries in an OLAP database can deliver answers with a better response time. The power of an OLAP database is its ability to quickly and dynamically summarize data by a variety of dimensions. In addition, an OLAP database provides a powerful calculation engine which supports ad hoc analysis to extend the value of the information beyond the data physically stored in the OLAP database.

162

Advanced Universe DesignLearners Guide

Dimensions
An OLAP database is constructed from multiple components.

In the example shown above, Location, Product, and Time are the "Dimensions". Dimensions define the numerical data under analysis. For example, knowing that there are $1 million in sales is not meaningful until you put this amount in context with one or more dimensions. Is this sales amount for one month or for one product or is it the annual sales for all products in a single city? A dimension is comprised of representative values, or "Members". Atlanta is a member of the Location dimension in the example above. When you query an OLAP database, you select one or more members of a dimension or you can choose to summarize all members of a dimension. For example, you can select a particular location or you can summarize all locations. When the design of a dimension allows this type of summarization, a special type of member known as the "All Member" is available to provide a summarized value for the members of that dimension. Members can be organized into multiple "levels". Time is a dimension which commonly contains many levels, often Year, Quarter, and Month. Depending on analytical requirements, this dimension can also include Week, Day, and even Hour and Minutes. Levels organize a dimension into a hierarchy with the most summarized values at the top and the most detailed values at the bottom. In the example above, Q1, Q2, Q3, and Q4 are all members of the Quarter level of the Time dimension, while Jan and Feb are members of the Month level of the same dimension. When you query an OLAP database, levels allow you to drill up or down a dimension to view summary or detailed data.

Measures
Dimensions form the sides, or axes, of a cube. The cube cells represent the intersection of each dimension member with members of all other dimensions. Contained within each cell is the "Measure", which is the numerical data being analyzed and summarized. A cube can contain one or more measures.

Creating Universes from Other Data SourcesLearners Guide

163

Generating universes from OLAP cube sources


An OLAP universe is created automatically from a selected connection to an OLAP data source. Note: OLAP universes support a single cube in the universe. OLAP structures are mapped directly to classes, measures, dimensions, details, and filters in the universe. The universe structure appears in the Universe pane, the Structure pane remains empty. You can use Universe Designer to create OLAP universes from the following OLAP data sources: SAP BW (Business Warehouse) Microsoft Analysis Services 2000 Microsoft Analysis Services 2005 Hyperion Essbase Once the universe has been created, it can be exported to the central management server (CMS) as any other universe. The universe is then available to Web Intelligence and Web Intelligence Rich Client users to run queries and create reports.

To create a universe from an OLAP cube


1. Open Universe Designer. 2. Create a new OLAP connection. Select Tools Connections. 3. Click Add. The New Connection Wizard opens. 4. Click Next. 5. Activate the Connection Type drop-down list to select the appropriate connection type; Secured, Shared, or Personal. 6. In the Connection Name field enter a name for the connection. 7. Expand the appropriate database node that supports the data access driver to the relevant OLAP data source. 8. Expand the appropriate middleware node that supports the data access driver to the relevant OLAP data source. 9. Select the appropriate data access driver to the relevant OLAP data source, and click Next. 10.In the Login Parameters window, fill in the appropriate authentication mode and login details to connect to your OLAP data source, and click Next. 11.The Catalog/Database parameters window displays the available OLAP cubes. Expand the OLAP Cubes node and select the appropriate OLAP cube to connect to, and click Test Connection. If the connection is valid, a message dialog box appears indicating that the connection is correct. If you receive an error message, check that you entered all the parameters correctly. 12.Click Next and click Finish twice to complete defining the OLAP connection.

164

Advanced Universe DesignLearners Guide

13. Create a new universe. Click File New. 14.Give the universe a name and a description. 15.Select the OLAP data source connection from the Connection drop-down menu, and click OK. The OLAP universe gets generated. This may take a few minutes depending on the cube size. OLAP structures are mapped directly to classes, measures, dimensions, details, and filters in the universe. The universe structure appears in the Universe pane.

Modifying and updating an OLAP universe


Once the OLAP universe has been automatically generated, designers are able to make the following types of modifications: Hide, duplicate, and rename classes and objects (dimension, detail, and measure) Insert new classes and objects (dimension, detail, and measure). Edit an object's format. Edit an object's data type (character and number only). Edit hierarchies. Use universe functions (@variable, @select, @prompt). Create a cascading list of values. Define a delegate search for a list of values, allowing users to limit loading of the list of values at query run time. Define measures with database delegated projection function (delegated measures). Create calculated measures (SAP BW and MSAS only). Run the Check Integrity or Parse tools at any time. Parse dimension, detail, and measure object MDX syntaxes.

Creating Universes from Other Data SourcesLearners Guide

165

Create predefined conditions/filters. Define optional prompts. The following Universe Designer features are not supported for OLAP universes: You cannot set row-level security authorizations in an OLAP universe. You cannot edit a list of values in an OLAP universe. You cannot view and edit the universe entity-relationship schema as no schema is generated for OLAP universes.

Delegated measures
OLAP cube aggregation is supported in Universe Designer with delegated smart measures. A delegated measure is a measure that delegates its aggregation calculation to the database. For OLAP universes, this allows the universe designer to use the cube aggregation calculated in the OLAP source. Web Intelligence reporting and layout workflows now work seamlessly on OLAP sources regardless of the nature of the measure. This greatly eases the user experience by simplifying workflows and reducing inconsistent results. Note: For MSAS 2000, MSAS 2005, and Essbase, by default, all measures generated in OLAP universes are defined as delegated measures. For SAP BW, the universe designer must set this option manually for each measure.

Calculated measures in OLAP universes


Calculated measures allow universe designers to create their own measures manually. In order to create calculated measures, designers create pure MDX expression embedded in new XML tags: <EXPRESSION></EXPRESSION> Universe Designer functions are allowed in calculated measure expressions, for example: @select @prompt @variable @where For example:
<EXPRESSION>@select(MEASURES GROUP\ORDER COUNT)*@select(MEASURES GROUP\SALES REVENUE)</EXPRESSION>

Note: Expressions for calculated measures cannot include the @aggregate_aware function. The check integrity validates the XML syntax and any of the Universe Designer functions. Universe Designer also supports constants in the expression such as: "10", "ABC", @prompt, and so forth. This is important to support constants as it could be used (like in relational universes) to pass dynamic values to the report: ratio, percentage, and so forth.

The Update OLAP Wizard


The Update OLAP Universe Wizard allows you to manage the life cycle of the OLAP universe. The wizard automatically refreshes the universe structure with changes made in the OLAP data source. The wizard compares the universe with the updated data source, and can

166

Advanced Universe DesignLearners Guide

differentiate generated objects from objects added or modified manually, allowing you to preserve the manual changes made in Universe Designer. It allows you to choose which strategy to adopt: Business Name Keep Replace. Object Type Keep Replace. LOV options Keep Replace. Deleted objects Delete from the Universe Keep and Hide: objects and add "/##/" as prefix to the Object name. A LOG file is generated at the end of the update process and can been saved on a hard disk to be reviewed later. In Universe Designer, designers can now run the Check Integrity tool after the update process. Note: The wizard does not update objects added manually in Universe Designer.

To refresh the structure of an OLAP universe


1. In Universe Designer, open the OLAP universe you want to update. 2. Select View Refresh Structure. The Update OLAP Universe Wizard appears. 3. Click Begin. The universe update option page appears. 4. Select the desired options you want to preserve modifications to manually made objects in the universe. All keep options are selected by default. 5. Click Finish. The Change Management Results page appears showing added/deleted/hidden objects. Hidden objects are moved to a separate class in the universe and appear in italic font preceded by /##/. 6. On the Change Management Results page, select OK, Export, or Check Integrity. OK: If you are not satisfied with the results, you can click OK, and then close the universe without saving or exporting. Export: If you are satisfied with the changes, click Export to save and export the updated universe to the CMS. Check Integrity: Click Check Integrity to perform an integrity check. The integrity tool checks the structure, parses objects, parses joins, parses conditions, and checks cardinality. When the check is complete, the Integrity Check Results page appears. From this page you can print the results of the check.

Creating Universes from Other Data SourcesLearners Guide

167

Activity: Creating an OLAP universe


Objective
Create a universe from an OLAP cube

Instructions
1. Open Universe Designer. Create a new OLAP_xx connection, where "xx" stands for your initials, with the following parameters: Connection Type: Secured Connection Name: OLAP_xx (where "xx" stands for your initials) Database middleware: Microsoft MS Analysis Services 2005 OLE DB for OLAP Providers 2. In the connection Login Parameters window enter the following parameters: Use specified username and password. For user name and password, use the credentials as provided by the instructor. Enter the server name as provided by the instructor. 3. Click Next. The Catalog/Database parameters window displays the available OLAP cubes. 4. Select OLAP Cubes Motors (Motors) Motors (Motors), and click Test Connection. 5. Create a new MotorsOLAP_xx universe, (where "xx" stands for your initials), using your created secured OLAP connection. 6. Save your universe locally and test it in Web Intelligence Rich Client.

168

Advanced Universe DesignLearners Guide

Quiz: Creating universes from other data sources


1. What three tasks can you perform in the Metadata Exchange panel? 2. True or False. A stored procedure is a compiled SQL program, consisting of one or more SQL statements, which resides and runs on the target database. 3. True or False. When creating an OLAP universe, no tables are generated in the Structure pane. 4. True or False. Stored procedures are represented as Derived Tables, thus they benefit from Derived Table mechanisms and concepts.

Creating Universes from Other Data SourcesLearners Guide

169

Lesson summary
After completing this lesson, you are now able to: Create a universe from an XML metadata file Create stored procedure and JavaBeans universes Work with OLAP universes

170

Advanced Universe DesignLearners Guide

Appendix A

End of Course Challenge


Activity: Completing the end of course challenge
Objectives
Build YTD objects in the Motors universe Use aggregate awareness to optimize the universe Prestige Motors management is finding that their monthly reports take a long time to run. They have requested that these reports be produced without any noticeable processing delay, however, no changes can be made to the existing data store structure. In addition they would like to review the universes for possible optimization. Year to date data needs to be implemented to get up to today's sales revenue data. 1. Open your Motors universe file in Universe Designer. 2. Create a new derived table called DT_Monthly_Figures. Add the following SQL Syntax for the table:
SELECT MODEL.MAKER_ID, SALE.SHOWROOM_ID, datepart(m,SALE.SALE_DATE) as Month,datepart(yy,SALE.SALE_DATE) as Year,sum(SALE.SALE_TOTAL) as Monthly_Sales, sum(SALE_MODEL.SALE_QTY * MODEL.MODEL_PRICE * ((100 -SALE.SALE_DISCOUNT) / 100)) as Monthly_Sales_Revenue FROM SALE_MODEL, MODEL, SALE WHERE (SALE.SALE_ID=SALE_MODEL.SALE_ID) AND ( SALE_MODEL.MODEL_ID= MODEL.MODEL_ID ) AND ( SALE.SALE_TYPE='S' ) GROUP BY datepart(yy,SALE.SALE_DATE),datepart(mm,SALE.SALE_DATE),SALE.SHOWROOM_ID,MODEL.MAKER_ID

3. Create a new Monthly Figures class to contain the following monthly figures objects, based on the DT_Monthly_Figures table: Month Year Monthly Sales Revenue 4. Join the derived table with the MAKER and SHOWROOM tables using the appropriate foreign keys and update the Sales context as required. 5. Update the existing Sales Revenue measure SQL syntax to include a month value aggregation level.

End of Course ChallengeLearners Guide

171

Tip: Check other objects that reference the monthly aggregate, for example year object in the Financial Period class. 6. Set incompatibilities where required. 7. Test the aggregation level generations by running test queries in the Universe Designer Query Panel. Use the View SQL button to verify if the generated SQL is correct. Alternatively save the universe and test in Web Intelligence Rich Client. 8. Create a new class called Current Dates and insert the following objects:
Date Object Current Date Current Year Current Month SELECT syntax getdate() Description Returns the current date and time. Returns the current year. Type Date

datepart(yyyy,getdate())

Number

datepart(mm,getdate())

Returns the current month

Number

Note: These objects are not based on any database columns and do not parse as they are lacking a reference table. To check if the syntax is correct click Tables, select the SALE table, apply the changes and click Parse. 9. There are no current date values in the Motors database. To ensure that you can create YTD objects, create a new derived table. Select Insert Derived Tables from the toolbar menu. 10.Name the table DT_Sale_YTD. 11.Add the following syntax to the derived table SELECT statement:
SELECT CLIENT_ID,SALE_ID, FROM SALE WHERE CLIENT_ID = (1089) UNION SELECT CLIENT_ID,SALE_ID, FROM SALE WHERE CLIENT_ID = (1088) UNION SELECT CLIENT_ID,SALE_ID, FROM SALE WHERE CLIENT_ID = (1087) UNION SELECT CLIENT_ID,SALE_ID, FROM SALE SALE_TOTAL, getdate() as SALE_DATE

SALE_TOTAL, dateadd(mm,-1,getdate()) as SALE_DATE

SALE_TOTAL, dateadd(mm,-2,getdate()) as SALE_DATE

SALE_TOTAL, dateadd(yy,-1,getdate()) AS SALE_DATE

172

Advanced Universe DesignLearners Guide

WHERE CLIENT_ID = (1086)

12.Check the syntax and click OK. 13.As you need to ensure that all tables are part of a context you need to join the DT_Sale_YTD table to the CLIENT table via the CLIENT_ID. 14.Detect the cardinality and create a new context for the join between the DT_Sale_YTD and CLIENT tables. Name the context SALE_YTD. 15.Create a YTD Objects class, and add the following objects based on the SALE_YTD derived table:
Object Sales Total (SALE_YTD table) Sale Date (SALE_YTD table) SELECT Syntax sum(DT_Sale_YTD.SALE_TOTAL) DT_Sale_YTD.SALE_DATE

16.Double-click the Sale Date (SALE_YTD table) object and click on the Properties tab. 17.Select the Automatic Time Hierarchy button and create a year and month object. 18.Create the following indicator or boolean flag objects in the YTD Objects class that are used to create YTD measure objects in the remaining activity steps:
Boolean Flag Object SELECT Syntax

Sales in YTD flag

CASE WHEN THEN ELSE

@select(YTD Objects\Year of Sale Date (SALE_YTD table)) @select(Current Dates\Current Year) 1 0 END

Sales in YTD flag - current month

CASE @select(YTD Objects\Year of Sale Date (SALE_YTD table)) WHEN @select(Current Dates\Current Year) THEN 1 ELSE 0 END * CASE sign(@select(Current Dates\Current Month)@select(YTD Objects\Month of Sale Date (SALE_YTD table))) WHEN 1 THEN 1 ELSE 0 END

19.Create the following relative date-time measure objects in the YTD Objects class:

End of Course ChallengeLearners Guide

173

Measure Object SELECT syntax sum((DT_Sale_YTD.SALE_TOTAL)* @select(YTD Objects\Sales in YTD flag))

Total Sales YTD

Total Sales YTD - current month

sum((DT_Sale_YTD.SALE_TOTAL)* @select(YTD Objects\Sales in YTD flag - current month))

20.Save the changes and test the results in Web Intelligence Rich Client. 21.Run a new query using the Sale Date (SALE_YTD table), Sale_Total (SALE_YTD table), Total Sales YTD and the Total Sales YTD - current month objects.

174

Advanced Universe DesignLearners Guide

Appendix B

Data Access Files


BusinessObjects data access files
A number of driver level files used by specific data access drivers are installed with the BusinessObjects product suite. This unit will look at the individual data access files and at advanced connection parameters that can be used to enhance your universe deployment. Data access is managed by the Connection Server. The Connection Server is the Business Objects connection engine that creates and manages connections used by universes between BusinessObjects data access drivers and the target RDBMS middleware. The Connection Server libraries are present on the Web Intelligence Report Server, Desktop Intelligence Report Server and Web Intelligence Job Server which allows these services to query the database directly without communicating with the Connection Server service. The Connection Server and the required data access components are automatically installed when you install Business Objects. Data access drivers can be found in the installation directory:
C\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionsServer\<RDBMS> Driver specific file Description

<driver><language>.stg

Contains the help text for each external strategy defined in the <driver>.stg file. This text appears when the strategy is selected in a universe. Contains the external strategies available to data access driver.
Note: External Strategies will be covered later on in Lesson 7 External strategies

For example: sqlsrven.stg

<driver>.stg

For example: sqlsrv.stg or oracle.stg

<driver>.sbo

For example: odbc.sbo

Defines all databases supported and the specific connectivity configuration for each database. Contains the help text for functions that are listed in the <driver>.prm file. This text appears when the function is selected in Universe Designer.

<driver><language>.prm

For example: sqlsrven.prm

Data Access FilesLearners Guide

175

Driver specific file <driver>.prm

Description

For example: sqlsrv.prm

Defines the information parameters and functions related to the database. Stores information related to connection Note: Do not modify this file.

<driver><language>.cod

For example: odbcen.cod

How can you quickly identify which data access files are being used? By looking at the connection details. Select File Parameters . On the Definition menu click the Test button for the Connection. Click on Details. This will show the version of BusinessObjects Enterprise used, the network layer. The details are split up into two parts: Business Objects configuration

This section highlights the BusinessObjects version used, and the network layer as defined in the connection. Note: The line <DBMS Engine: MS SQL Server 2005> is what has been defined in the connection. This does not mean that the database connected to is actually MS SQL Server 2005. The database version connected to is outlined in the Middleware and DBMS Configuration section. The BusinessObjects Configuration section also highlights the library of data access files used. Note: Double-click on the path to view the full path, or to copy the path. Middleware and DBMS Configuration

176

Advanced Universe DesignLearners Guide

The Middleware and DBMS Configuration section highlights the actual Database Management System (DBMS) that you are connected to, and the version. This can be an important indicator that no cross reference of DBMS versus what is specified in the connection occurs.

The SBO file


The SBO file is a parameter file used to configure the behavior of some of the connection parameters. For each access driver (RDBMS) there is one SBO file that contains the appropriate connection parameters. Each <driver>.sbo file contains the following: Default parameters that apply to all connections using the data access driver. A list of database middleware that the driver supports. This list can also contain aliases for middleware versions that are no longer supported, but which are still used by connections defined with the data access driver. Each middleware entry can have default parameters set that apply only to that database middleware. For example for Microsoft SQL Server 2005 you will find the following settings in the ODBC.sbo file:
<DataBase Active="Yes" Name="MS SQL Server 2005"> <Libraries> <Library>dbd_wmssql</Library> <Library>dbd_mssql</Library> </Libraries> <Parameter Name="Family">Microsoft</Parameter> <Parameter Name="Version">rdbms_mssqlserverodbc.txt</ Parameter> <Parameter Name="SQL External File">sqlsrv</Parameter <Parameter Name="SQL Parameter File">sqlsrv</Parameter> <Parameter Name="Strategies File">sqlsrv</Parameter> <Parameter Name="Array Bind Available">True</Parameter> <Parameter Name="CharSet Table" Platform="Unix">datadirect <Parameter Name="Driver Name">SQL Server</Parameter> </DataBase>

The table below outlines what some of the above shown parameters mean:

Data Access FilesLearners Guide

177

Parameter

Description

Family

This specifies the family of database engine to be displayed in the Database Middleware Selection page of the new connection wizard. The middleware that correspond to your data access key are displayed on this page in a tree view.
Note: Do not modify this parameter.

Array Bind Variable

The bind array is the area in memory that Connection Server stores a batch of data to be loaded (sent to the repository). When the bind array fills, it is transmitted to the database. This parameter specifies if the database supports this method. Values can be set to True or False, the default value is set to True Specifies the limitations of each driver. This setting is specific to each <driver>.sbo file 1 specifies that you can only use the driver to create and execute queries. 13 specifies that you can use the driver to create and execute queries, and to create universe folders. 15 specifies that you can use the driver to create the BusinessObjects repository, and to create and execute queries. 31 specifies that you can use the driver to create the BusinessObjects repository, to create and execute queries, and to access stored procedures.

Driver Level

CharSet Table

Specifies the Charset file (.crs) for the data access driver with no extension. This setting is specific to each .sbo file. The .crs file is in the same directory as the .sbo file.

Some <driver>.sbo files contain parameters that are also set in the cs.cfg file. The values set in the SBO file can over-ride the values in the cs.cfg file. Note: Prior to making any changes in the .SBO file, you need to create a backup. The .SBO file is a system file. Consult your database administrator before making any changes. Note: All data access files are now in XML format. Although XML files may be opened in any text editor such as WordPad or Notepad, only an editor designed for XML should be used to edit such files. Editing XML files without a proper editor may create file corruptions which can result in problems with demonstrations and activities. Note: Consult the BusinessObjects XI 3.0: Data Access Guide for more information on the .SBO file.

178

Advanced Universe DesignLearners Guide

The CS.CFG file


The cs.cfg file is a data access general configuration file in XML format that contains default configuration parameters that apply to all data access drivers. The cs.cfg file is stored at the root level for the connectionServer:
C\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionsServer\

Note: The cs.cfg file is an XML file. The Document Type Definition (DTD) file that relates to each element used in the cs.cfg file is in the same directory. Make sure that, when editing and/or modifying the XML file, the cs.dtd is accessible. There are five XML elements in the cs.cfg file: Locales: This element defines the usual operating system charset for a given language. The locales are UNICODE compliant which allows SQL UNICODE to be used. Note that for some databases, SQL Server included, the SQL UNICODE settings are set to NVARCHAR. To allow for UNICODE compliancy the UNICODE setting in the PRM file or the UNICODE Dynamic SQL Parameter in the universe needs to be set accordingly. Settings: This element defines parameters that apply to all data access drivers, for example the file extensions of files used by Connection Server to manage data access. Some settings can be defined either for library version or server version of Connection Server. Library: parameters apply to a standard Connection Server installation. It is installed with other BusinessObjects desktop or server software. This is the default mode when you install a BusinessObjects product that is installed automatically with Connection Server. Server: parameters apply to a Connection Server stand alone server installation. It is installed alone with no other BusinessObjects desktop or server product. Distribution: This element contains two sub elements; Protocols and Lookup. The protocols element contains settings that the Connection Server uses to process requests coming from CORBA clients or HTTP clients. The Lookup element allows you to expose the target RDBMS that corresponds to a specific ODBC network layer to Connection Server. This applies when Connection Server is using two different data access drivers, for example Microsoft SQL Server and Microsoft Access, through a common ODBC network layer. By default, Lookup is set to No, so Connection Server associates a target RDBMS to its ODBC network layer. However, if Connection Server is being used as a standalone server, and has two databases that are accessed by the same ODBC network layer, the specific target database information must be exposed to Connection Server to allow queries to be routed through ODBC to the correct data account. Driver defaults:

Data Access FilesLearners Guide

179

Data access driver parameters that are also found in driver specific SBO files. The values set for these parameters apply to all data access drivers. Parameters specified in the SBO file can over-ride the parameters set in the cs.cfg file. For example the cs.cfg holds the default settings for the Array Fetch Size and Array Bind Size values, in the oracle.sbo file you can define different Array Fetch size and Array Bind size values. These values are normally set in individual universe connections in the Advanced Parameters and Custom Parameters menus. If no values are changed in these menus when defining the universe connection, the default settings from the cs.cfg will be used instead. If these values have been altered in the SBO file, this file over-rides the default from the cs.cfg file. Traces: You can set trace parameters that allow the recording of connection activity through Connection Server in log files. Note: Consult the BusinessObjects XI 3.0: Data Access Guide for more information on the cs.cfg file.

180

Advanced Universe DesignLearners Guide

The PRM file


A number of driver level files used by specific data access drivers are installed with the BusinessObjects product suite. This unit will look at the individual data access files and at advanced connection parameters that can be used to enhance your universe deployment. Each data access driver is associated with a SQL parameters file (<driver>.prm). This PRM file contains default SQL parameters used for query generation, date and other operators, and functions. Each PRM file is structured into four groups: The configuration section holds the SQL parameters used to create and optimize a universe, for example, COMMA, OWNER, QUALIFIER, and OUTERJOINS_ GENERATION The date operations section holds the date operators available to Universe Designer and the BusinessObjects end user querying tools. For example YEAR, QUARTER and MONTH options. The operators section holds the operators available to Universe Designer and the BusinessObjects end user querying tools, for example ADD, MULTIPLY and SUBSTRACT. The functions section holds the functions available to Universe Designer, and the BusinessObjects end user querying tools, for example Average, Sum, and Variance.

Configuration

Date Operations

Operators

Functions

The function list shown in the PRM file never includes a complete list of available functions for the designated RDBMS. If additional functions are required for reporting purposes, the PRM file can be adapted and new functions can be added. When working in Universe Designer, you can add SQL functions directly into the Select statement box of an object. If functions are used frequently this way, instead of typing this in every time, it can be added to the PRM file to appear as a function in the list. Note: Prior to making any changes in the .PRM file, you need to create a backup. The .PRM file is a system file. Consult your database administrator before making any changes. Note: All data access files are now in XML format. Although XML files may be opened in any text editor such as WordPad or Notepad, only an editor designed for XML should be used to edit such files. Editing XML files without a proper editor may create file corruptions which can result in problems with demonstrations and activities. Note: Consult the BusinessObjects XI 3.0: Data Access Guide for more information on the .PRM file.

Data Access FilesLearners Guide

181

PRM file function help text


The help text that appears under each function when selected in Universe Designer is maintained in a separate file. In previous versions of Business Objects products this text was maintained in the same file as the PRM parameters. When you add a function to the PRM file, you need to add the Help text for the new function to the appropriate <driver><language>.prm file. Each <driver><language>.prm file has the following tags that need to refer to the each function added in the PRM file: Name: The name tag represents the name of the function. This is the name that appears in the function list in Universe Designer, and needs to correspond with the name of the function in the <driver>.prm file. Message: This tag is split up into two ID tags. The first ID tag represents the help text for the function that will be seen in Universe Designer. The second ID needs to convey the function name. Arguments: For each argument set in the function, you can add a help text message to convey what type of argument is expected to be used.

PRM file Configuration Parameters


The configuration section holds the SQL parameters used to create and optimize a universe. These parameters can be edited by altering the default values to a customized setting that can help optimize queries run against universes using the target data access driver. As with all parameter files, please make sure that settings are correctly defined and are compatible with the RDBMS in use. Certain configuration parameters must not be edited. These parameters have values set for use internally within a Business Objects product. Before editing any other PRM file parameter, you should make a backup copy of the PRM file. You can view, edit, and add parameters to a PRM file. Note: Consult the BusinessObjects XI 3.0: Data Access Guide for a full list of configuration functions that can be adapted in the PRM file. The PRM file is also used to allow the use of analytic functions. Analytic functions can be added directly to the Select statement if the RDBMS allows their use. To ensure correct use of the functions, the RISQL functions parameter has to be enabled in the PRM file. The following two parameters need to be added to the configuration section:
<Parameter Name="RISQL_FUNCTIONS">RANK,SUM,AVG,COUNT, MIN,MAX,DENSE_RANK,NTILE,ROW_NUMBER</Parameter> <Parameter Name="OVER_CLAUSE">Y</Parameter>

The first parameter lists the RISQL functions supported by the database. The Over Clause parameter allows BusinessObjects products to include aggregate analytic functions (for example, SUM OVER PARTITION BY) when generating SQL. Depending on the database used, in the PRM file you also need to apply parameter rules for the GROUP BY.

182

Advanced Universe DesignLearners Guide

Note: Consult the BusinessObjects XI 3.0: Designer's Guide for more information on analytic functions and the PRM file.

Data Access FilesLearners Guide

183

184

Advanced Universe DesignLearners Guide

Appendix C

External Strategies
Using external strategies in Universe Designer
Universe Designer uses built-in automated routines to automatically create universe components based on the database structure. These routines are called strategies and are available from the Strategies page of the Parameters dialog box. These strategies are built-in to Universe Designer. You cannot access or modify them. You can, however, create SQL scripts that follow a defined output structure to perform customized automatic universe creation tasks. You can select these from the Strategies page with the other strategies. These user defined and customized scripts are called External strategies. This appendix describes external strategies and their use.

What is an external strategy?


An external strategy is an SQL script stored externally to the .unv file, and structured so that it can be used by Universe Designer to automate object or join creation, and table detection tasks in a universe. External strategies are stored in an external strategy file with the extension .stg. There is an STG file for each supported RDBMS. These files can be found in the BusinessObjects installation directory:
C\Program Files\Business Objects\BusinessObjects Enterprise 12\win32_x86\dataAccess\connectionsServer\<RDBMS>\

External strategy files are in XML format. They can be edited or viewed in Notepad or Wordpad, but it is recommended to use an XML editor to make modifications.

Accessing External Strategies in Universe Designer


External strategies appear in the drop down list boxes that also list the built-in strategies on the Strategies page. Each drop down list box corresponds to a strategy type category in the XML file. An external strategy appears in the list with External Strategy prefixing the strategy name as follows:
External Strategy:<strategy name>

For example, an external strategy for join creation called Constraints in the Strategy file, appears as External Strategy: Constraints in the Joins drop down list on the Strategies page.

The Strategies Tab


The Strategies tab of the Universe Parameters dialog box defines how the universe uses information from the data dictionary to help you build the universe. A data dictionary is a set of system tables that your RDBMS automatically creates and maintains about the objects (tables, views, synonyms, owners) in your data source.

External StrategiesLearners Guide

185

The information in the Strategy dialog box is accessed by Universe Designer when: the quick design wizard is used to build a new universe. your database option for "Extract joins with tables" has been selected in Tools Options Database to assist in automatically creating tables and joins for a universe. tables, objects and joins are inserted via the toolbar icons or via the Insert menu. There are a number of default built-in strategies that provide a good starting point. However, if you have a data warehouse or DBMS that uses public synonyms (Oracle for example), you will need to create external strategies to ensure Universe Designer can see those synonyms as tables in the table browser. Built-in strategies can not be modified, so in order to get data source specific requirements added to the universe, designers can create customizable external strategies to reflect their needs. Strategies are SQL statements that read the data dictionary tables in your source system. The returned query results use that dictionary information to form of a list of potential tables, joins, classes and objects. In some cases Data warehouse tables have a DW prefix, for example DW_Sales_fact. If a built-in strategy is used to identify potential classes and objects, the proposed classes will also have a DW prefix. Classes and objects need to remain end users focused and should not be portrayed with confusing prefixes. Instead of using the built-in strategy and manually remove the prefixes, designers can create a customized strategy that identifies potential classes and objects, and that drops the DW from the proposed classes automatically.

186

Advanced Universe DesignLearners Guide

Types of strategies
There are three universe components that strategies interact with: objects, joins, and tables. To learn more about how strategies interact with these components we will look at how these are used in the built-in strategies.

Objects
The built-in object strategy determines how Universe Designer reads the table and column information from the data dictionary to come up with potential classes and objects (either when using the wizard or when inserting tables). By default, the data source table names are used as the proposed class names and the table columns are used as the proposed objects names. The built-in object strategy also converts all names to initial caps and removes the underscore (_) from any table and field names.

Joins
Universe Designer has four built-in strategies that automatically create joins in a universe. Edit manually (none): Joins are not created automatically. Database keys matching names: When using this strategy, joins are created automatically between columns that are indicated in the database as primary keys and foreign keys. All matching column names: This strategy identifies matching column names. When the column names match between two tables, the joins are automatically inserted, even if these columns are not designated primary or foreign keys. All matching numeric column names: When using this strategy, joins are created automatically between columns that are numeric and have matching names. In some schemas primary and foreign keys can be a date or char type, rather than a numeric value. This strategy would only propose join candidates for numeric fields. If you wish joins to be proposed for numeric, date, or character columns, select the preceding strategy.

Tables
The built-in table strategy selects all physical tables owned by the individual user specified in the connection parameters. If the owner of the tables in your DBMS is System, then you must log in with the user ID System for Universe Designer to find these tables. To avoid users to see Owner prefixes on tables you DBA can create synonyms (depending on the DBMS used), or can change the OWNER parameter in the <driver>.PRM file. When setting this parameter to N it drop the owner name from your table prefix and will cause the built-in strategies to look for public synonyms and views (for example, the user name specified in the connection parameters does not necessarily own the physical tables). Note: Setting the parameter OWNER to N without customizing an external strategy can also pick up unwanted system tables. If owner prefixes need to be excluded from tables names it is better to use an external table strategy that adapts to those needs instead of using the built-in-strategy. All these built-in strategies can be used as an example layout for customized external strategies. External strategies allow you to control how the data dictionary is read. They can be a useful solution for:

External StrategiesLearners Guide

187

database public synonyms extracting column comments from your source system and use them as object descriptions importing metadata from a text file

Accessing new external strategies in Universe Designer


After adding new strategies in the .STG file, you need to restart Universe Designer. To acces the added strategey : 1. Open a universe in Universe Designer 2. Select File Parameters from the menu bar. 3. Select the Strategies tab. 4. The drop-down arrows allow designers to select Object, Join, or Table strategies that were defined in the .STG file.

188

Advanced Universe DesignLearners Guide

Appendix D

SQL syntaxes for other RDBMS


Alternative SQL syntaxes for other RDBMS
This appendix provides the alternative SQL syntaxes for Oracle, MySQL, and DB2, for the objects and functions used within this course, sectioned by lesson and topic.

SQL syntaxes for other RDBMSLearners Guide

189

ORACLE
This section provides solution syntaxes for ORACLE, based on SQL examples used in the course.

Lesson 3 - Using database functions in objects


SQL Server Substring() Oracle Substr()

Instr() function. Can be used as: instr('some string','search string') instr('some string','search string',position) instr('some string','search string',position,occurence) CharIndex()

Course example syntax:


instr(CLIENT.CLIENT_AREA_CODE,' ') substr(CLIENT.CLIENT_AREA_CODE,1,instr( CLIENT.CLIENT_AREA_CODE,' ')-1)

Fn_Length()

Length() Substr() Substr() returns part of a character string beginning at start

position, length characters long. if start is positive, Oracle counts from the beginning of the string.
Fn_Right() (or Right(,))

if start is negative, Oracle counts backwards from the end of the string. if length is omitted, Oracle returns all characters to the end of the string. This example returns the first four characters of the Client Name column:
substr(CLIENT.CLIENT_NAME,1,4)

Substr() Fn_Left() (or Left(,))

This example returns the last four characters of the Client Name column:
substr(CLIENT.CLIENT_NAME,-4)

Ceiling() Floor() Round()

Ceil() Floor() Round( number, [ decimal_places ] )

190

Advanced Universe DesignLearners Guide

SQL Server CAST()

Oracle CAST() CASE WHEN THEN ELSE END or Decode()

Course example syntax:


CASE WHEN THEN ELSE END CASE instr(CLIENT.CLIENT_PHONE_NO,'(') WHEN 0 THEN CLIENT.CLIENT_PHONE_NO ELSE substr(CLIENT.CLIENT_PHONE_NO,instr(CLIENT.CLIENT_PHONE_NO,'(') ,instr(CLIENT.CLIENT_PHONE_NO,')')) END

Lesson 3 - Constructing relative date-time objects


SQL Server Oracle

Oracle uses TO_CHAR() to extract date parts:


TO_CHAR(SALE.SALE_DATE,'Q')

You can add the following parameters to the To_char function to extract date parts:
YEAR YYYY Q MM MON MONTH Year, spelled out 4-digit year Quarter of year (1, 2, 3, 4; JAN-MAR = 1). Month (01-12; JAN = 01). Abbreviated name of month. Name of month Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year. Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh. Week of year (1-52 or 1-53) based on the ISO standard. Day of week (1-7). Name of day.

{fn year()} {fn month()} {fn week()} {fn dayofweek()} Datepart(qq, )

WW

IW D DAY

SQL syntaxes for other RDBMSLearners Guide

191

SQL Server

Oracle DD DDD DY Day of month (1-31). Day of year (1-366). Abbreviated name of day.

To add a "Q" for formatting:


CONCAT('Q',TO_CHAR(SALE.SALE_DATE,'Q'))

DATEADD ( datepart , number, date ) DateAdd()

You can also use the Add_Months() function.


Substr()

DateDiff()

There is no real equivalent in Oracle. You can use months_between(date 2, date 1)or subtract one date directlyt from another date.
To_Char() Sysdate() or current_date() to_date(to_char(Sysdate(),'YYYY') 'YYYY') to_date(to_char(Sysdate(),'MM') 'MM') Add_Months(12,sysdate()) to_date(to_char(@Select(Sales Dates\Sales Date Prompt),'YYYY') 'YYYY') to_date(to_char(@Select(Sales Dates\Sales Date Prompt),'MM') 'MM')

DateName() Current Date Current Year Current Month Next Year Sales Year Prompt

Sales Month Prompt

Lesson 4 - Working with advanced LOVs


SQL Server SELECT max(Datename(mm,RENTAL.SALE_DATE)) FROM SALE RENTAL WHERE ( RENTAL.SALE_TYPE='R' ) GROUP BY Datename(mm,RENTAL.SALE_DATE), Datepart(mm,RENTAL.SALE_DATE) Oracle SELECT max(TO_CHAR(RENTAL.SALE_DATE,'MM')) FROM SALE RENTAL WHERE ( RENTAL.SALE_TYPE='R' ) GROUP BY TO_CHAR(RENTAL.SALE_DATE,'MM')), TO_NUMBER(TO_CHAR(RENTAL.SALE_DATE,'MM'))

192

Advanced Universe DesignLearners Guide

SQL Server ORDER BY Datepart(mm,RENTAL.SALE_DATE)

Oracle ORDER BY TO_NUMBER(TO_CHAR(RENTAL.SALE_DATE,'MM'))

SELECT max(datename(weekday,SALE.SALE_DATE)) FROM SALE WHERE ( SALE.SALE_TYPE='S' ) GROUP BY Datename(weekday,SALE.SALE_DATE), {fn dayofweek(SALE.SALE_DATE)} ORDER BY{fn dayofweek(SALE.SALE_DATE)}

SELECT max(TO_CHAR(RENTAL.SALE_DATE,'D')) FROM SALE RENTAL WHERE ( RENTAL.SALE_TYPE='R' ) GROUP BY TO_CHAR(RENTAL.SALE_DATE,'D')), TO_NUMBER(TO_CHAR(RENTAL.SALE_DATE,'D')) ORDER BY TO_NUMBER(TO_CHAR(RENTAL.SALE_DATE,'D'))

CAST({fn dayofweek(SALE.SALE_DATE)} as Varchar) + '- ' + datename(weekday, SALE.SALE_DATE)

TO_CHAR(RENTAL.SALE_DATE,'Day') + '- ' + TO_CHAR(RENTAL.SALE_DATE,'D')

SQL syntaxes for other RDBMSLearners Guide

193

MySQL
This section provides solution syntaxes for MySQL, based on SQL examples used in the course.

Lesson 3 - Using database functions in objects


SQL Server Substring() MySQL Substring()

CharIndex() CharIndex() substring(CLIENT.CLIENT_AREA_CODE,1,charindex(' ', CLIENT.CLIENT_AREA_CODE))

Fn_Length() Fn_Right() (or Right(,)) Fn_Left() (or Left(,)) Ceiling() Floor() Round() CAST() CASE WHEN THEN ELSE END

Length() Right() Left() Ceil() Floor() Round() CAST()

CASE WHEN THEN ELSE END

Lesson 3 - Constructing relative date-time objects


SQL Server MySQL Year() {fn year()} Month() {fn month()} MonthName() {fn week()} Week() {fn dayofweek()} WeekDay() Datepart(qq, ) Quarter() DATE_ADD(date,INTERVAL exprunit) DateAdd() SELECT DATE_ADD('1998-01-02', INTERVAL 31 DAY)

194

Advanced Universe DesignLearners Guide

SQL Server DateDiff()

MySQL DateDiff() or TO_DAYS(date2) - TO_DAYS(date1)

MonthName() DateName() WeekDay() Current Date Current Year CURDATE() or NOW() to_date(to_char(Sysdate(),'YYYY') 'YYYY')

Month(CURDATE()) Current Month MonthName(CURDATE()) Next Year Sales Year Prompt Sales Month Prompt DATE_ADD(CURDATE(), INTERVAL 12 MONTH) Year(@Select(Sales Dates\Sales Date Prompt) Month(@Select(Sales Dates\Sales Date Prompt)

Lesson 4 - Working with advanced LOVs


SQL Server SELECT max(Datename(mm,RENTAL.SALE_DATE)) FROM SALE RENTAL WHERE ( RENTAL.SALE_TYPE='R' ) GROUP BY Datename(mm,RENTAL.SALE_DATE), Datepart(mm,RENTAL.SALE_DATE) ORDER BY Datepart(mm,RENTAL.SALE_DATE) MySQL

SELECT max(MonthName(RENTAL.SALE_DATE)) FROM SALE RENTAL WHERE ( RENTAL.SALE_TYPE='R' ) GROUP BY MonthName(RENTAL.SALE_DATE), Month(RENTAL.SALE_DATE) ORDER BY Month(RENTAL.SALE_DATE)

SELECT max(datename(weekday,SALE.SALE_DATE)) FROM SALE WHERE ( SALE.SALE_TYPE='S' )

SELECT max(WeekDay(RENTAL.SALE_DATE)) FROM SALE RENTAL WHERE ( RENTAL.SALE_TYPE='R' ) GROUP BY WeekDay(RENTAL.SALE_DATE),

SQL syntaxes for other RDBMSLearners Guide

195

SQL Server GROUP BY Datename(weekday,SALE.SALE_DATE), {fn dayofweek(SALE.SALE_DATE)} ORDER BY{fn dayofweek(SALE.SALE_DATE)}

MySQL

Week(RENTAL.SALE_DATE) ORDER BY Week(RENTAL.SALE_DATE)

CAST({fn dayofweek(SALE.SALE_DATE)} as Varchar) + '- ' + datename(weekday, SALE.SALE_DATE)

CAST(Week(SALE.SALE_DATE) as Varchar) + '- ' + WeekDay(SALE.SALE_DATE)

196

Advanced Universe DesignLearners Guide

DB2
This section provides solution syntaxes for DB2, based on SQL examples used in the course.

Lesson 3 - Using database functions in objects


SQL Server Substring() DB2 Substr()

LOCATE(<Search String>,<Actual String>, <Starting Position>) CharIndex()

Course example syntax:


substr(CLIENT.CLIENT_AREA_CODE,1,LOCATE(' ', CLIENT.CLIENT_AREA_CODE))

Fn_Length() Fn_Right() (or Right(,)) Fn_Left() (or Left(,)) Ceiling() Floor() Round() CAST()

Length()

Right()

Left() Ceil() Floor() Round( number, [ decimal_places ] ) CAST() CASE WHEN THEN ELSE END

Course example syntax:


CASE WHEN THEN ELSE END CASE LOCATE(CLIENT.CLIENT_PHONE_NO,'(') WHEN 0 THEN CLIENT.CLIENT_PHONE_NO ELSE substr(CLIENT.CLIENT_PHONE_NO,LOCATE(CLIENT.CLIENT_PHONE_NO,'(') ,LOCATE(CLIENT.CLIENT_PHONE_NO,')')) END

Lesson 3 - Constructing relative date-time objects


SQL Server {fn year()} {fn month()} {fn week()} {fn dayofweek()} DB2 Year() Month() MonthName() DayOfWeek()

SQL syntaxes for other RDBMSLearners Guide

197

SQL Server

DB2 Week() Day()

Datepart(qq, ) DayName() Quarter()

DB2 adds date values by using "- <datetype>" and "+ datetype"
SALE.SALE_DATE -5 day SALE.SALE_DATE +5 day DateAdd() SALE.SALE_DATE -5 months SALE.SALE_DATE +5 months SALE.SALE_DATE -5 year SALE.SALE_DATE +5 year DateDiff() timestampdiff() or DateDiff()

MonthName() DateName() DayOfWeek() DayName() Current Date DATE() or Current Date

Year(Date()) Current Year Year(Current Date)

Month(Date()) Current Month Month(Current Date) Next Year Sales Year Prompt Sales Month Prompt Year(Current Date + 1 year) Year(@Select(Sales Dates\Sales Date Prompt) Month(@Select(Sales Dates\Sales Date Prompt)

198

Advanced Universe DesignLearners Guide

Lesson 4 - Working with advanced LOVs


SQL Server SELECT max(Datename(mm,RENTAL.SALE_DATE)) FROM SALE RENTAL WHERE ( RENTAL.SALE_TYPE='R' ) GROUP BY Datename(mm,RENTAL.SALE_DATE), Datepart(mm,RENTAL.SALE_DATE) ORDER BY Datepart(mm,RENTAL.SALE_DATE) DB2

SELECT max(MonthName(RENTAL.SALE_DATE)) FROM SALE RENTAL WHERE ( RENTAL.SALE_TYPE='R' ) GROUP BY MonthName(RENTAL.SALE_DATE), Month(RENTAL.SALE_DATE) ORDER BY Month(RENTAL.SALE_DATE)

SELECT max(datename(weekday,SALE.SALE_DATE)) FROM SALE WHERE ( SALE.SALE_TYPE='S' ) GROUP BY Datename(weekday,SALE.SALE_DATE), {fn dayofweek(SALE.SALE_DATE)} ORDER BY{fn dayofweek(SALE.SALE_DATE)} SELECT max(DayOfWeek(RENTAL.SALE_DATE)) FROM SALE RENTAL WHERE ( RENTAL.SALE_TYPE='R' ) GROUP BY DayOfWeek(RENTAL.SALE_DATE), Week(RENTAL.SALE_DATE) ORDER BY Week(RENTAL.SALE_DATE)

CAST({fn dayofweek(SALE.SALE_DATE)} as Varchar) + '- ' + datename(weekday, SALE.SALE_DATE)

CAST(Week(SALE.SALE_DATE) as Varchar) + '- ' + DayOfWeek(SALE.SALE_DATE)

SQL syntaxes for other RDBMSLearners Guide

199

200

Advanced Universe DesignLearners Guide

Answer Key
This section contains the answers to the reviews and/or activities for the applicable lessons.

Answer KeyLearners Guide

201

202

Advanced Universe DesignLearners Guide

Review: Using universe design concepts


Page 2
1. What is a universe? Answer: The BusinessObjects universe is the semantic layer that isolates business users from the technical complexities of the databases where their corporate information is stored. For the ease of the end user, universes are made up of objects and classes that map to data in the database, using everyday terms that describe their business environment. 2. Does a universe store data? Answer: You associate data to universes by mapping to a data source. Data is not stored in the .unv file. 3. What are the main advantages of a universe? Answer: Only the universe designer needs to know how to write SQL and understand the structure of the target database. The interface allows you to create a universe in an easy-to-use graphical environment. Data is secure. Users can see only the data exposed by the universe. Users can only read data, not edit it. The results are reliable and the universe is relatively easy to maintain. Users can use a simple interface to create reports. All users work with consistent business terminology. Users can analyze data locally. 4. Describe the connection types and their purposes. Answer: Secured: Use this connection to enable your universe to be exported to the BusinessObjects Enterprise repository. Shared: Use this connection to share your universe across the network with other designers. Personal: Use this connection if the universe is solely for a single user and there is no need to neither share nor publish this universe to the Enterprise system. 5. What are the types of objects that can be created in a universe? Provide a brief description of each type. Answer: Dimension: These objects relate to the key information being retrieved from the database. They can be date, character, or number type, and may contain a calculation. They are used in queries and condition/filters and can also be used to drill on in hierarchies and link on between queries.

Answer KeyLearners Guide

203

Detail: These objects relate to supportive information and are associated with dimensions. They can be date, character, or number type, and may contain a calculation. They are used in queries and condition/filters but cannot be used to drill on or link on between queries. Measure: These objects are dynamic aggregates and are always a number type, containing functions like Sum, Count, Average, Max, or Min. Depending on the other objects in the query, they dynamically aggregate themselves when displayed in the report block. Predefined Condition/Filter: These objects contain a name, a description and a restriction. They are designed to give the user a choice as to whether to apply a condition filter or not. They can be quite basic, or can contain a complex where clause. 6. What are the different join types allowed in the universe structure. Provide a short description of each type. Answer: Equi: This join works on the principle of the data in the fields that are a joined match, for example Customer ID = Customer ID, therefore returning data from both tables where the data matches. Outer: This join works in the same way as an equi-join, however there may be data in one table but not the other, and the requirement is for the data to be returned regardless. For example, a join between Customer and Sales would be based on Customer ID, however a customer may still be prospective and not have any records in the sales table, but all customers must be reported on regardless of sales. Complex/Theta: This join works on the Between principle. For example, a sales date may be joined to a begin and also an end date in a table which is date based, for example sales date between begin date and end date. Self-restricting: This join works as a restriction on the table. If there is a field that can be used as a flag on a table, then this join would allow that flag to be referenced every time the table is used in the SQL statement. Self-referencing: A self-referencing join is a join from one column of a table to another column of the same table. This join should not be used as it creates a loop. Ideally, if this join exists, then the table should be aliased and the appropriate join and cardinality should be assigned. Shortcut: A shortcut join is a join that provides an alternate path between two tables. It improves the performance of a query by not taking into account intermediate tables, and shortening a normally longer join path. 7. What are the different types of SQL traps that can be found in a schema? How can each of these types be identified? How can each type be resolved in the universe schema? Answer: Chasm Trap: Identify - A chasm trap is essentially a many-to-one-to-many relationship and may be seen as a parent table with two child tables, the child tables having the many end

204

Advanced Universe DesignLearners Guide

of the relationship. If a query is run with a chasm trap, depending on the objects used, either too many or not enough rows (but aggregation may be affected) are produced. Resolve - Best resolved by using contexts.

Fan Trap: Identify - A fan trap is identified as a one-to-many or a one-to-many-to-many relationship. In itself, this isn't an issue - what is the issue is if there are two fields being used as aggregates and they are at different levels in the path. This can give the same result as a chasm trap. Resolve - If they can be avoided by using the lowest level of granularity then this is the best practice, however that isn't always possible. In which case, a combination of aliases and contexts resolves the fan trap.

8. What are loops and how can they be resolved? Answer: Loops are joins between tables that (eventually) come back to the starting point, forming a circle, or loop. Usually the error Incompatible combination of objects alerts you to the fact you may have a loop. 9. Describe how you would test a measure to make sure the aggregation levels are projected correctly. Answer: To test a measure correctly, a minimum of three queries should be created. 1. 2. The measure on its own. The measure with two different dimensions, in different queries. Once the table has been projected, remove the dimensions and then add them again using the drag and drop method. This checks the aggregation in the report is correct. Applying a total to the tables checks (if they are all the same total) the aggregation level from the database.

3.

10.Explain two drawbacks of using restrictions at the object level. Answer: Two drawbacks: 1. Conflicting restrictions in the objects may be confusing if those objects are placed in the query. For example: UK customers, US customers. Effectively you are saying they must be UK and US at the same time, this is a conflict so no data is returned. Creates a flat level at the end of the class making drilling through the hierarchy difficult.

2.

11.Describe the use of the @select function. Answer: The @select function has no benefit to the end user. However, it does have benefit to the designer, as this is how they can reuse code between objects.

Answer KeyLearners Guide

205

12.What is a hierarchy? Answer: A hierarchy is the order of dimensions in a "class" in a one-to-many order. Hierarchies can be default (or natural) and custom. 13.Describe what a derived table is and how it is generally used in a universe schema. Answer: A derived table is a table that contains an SQL statement. It is generally used: When it is not possible to create a table at the database level, especially if there is a need to link two otherwise un-linkable tables together To create a table based on a restriction - instead of aliasing tables based on their flag and using self-restricting joins 14.Describe what index awareness is, and how it is used in a universe schema. Answer: Index awareness is a way of utilizing the indexing in the database to enable queries to be more efficient in the SQL that they generate. It is set up via the object properties. 15.What are the pros and cons of delegated functionality in a universe-based reporting structure? Answer: Delegated or "smart" measure objects were discussed in the core Universe Design class. The objective is to shift the responsibility for the aggregation to the data source, instead of the universe This allows for complex and weighted calculations of dimensional subsets, but requires a refresh to the data source in order to display the results in the Web Intelligence report.

206

Advanced Universe DesignLearners Guide

Quiz: Working with aggregate awareness


Page 28
1. How does the @aggregate_aware function improve query performance? Answer: It directs the query to run against aggregate tables or summary tables, whenever possible. 2. Why does using summary table data speed up response times? Answer: There are fewer rows to process. Value calculation is not required. Fewer, if any, joins are required. 3. The tool you use in Universe Designer to set incompatibilities between objects and tables in the structure of the universe is called the ___________________ tool. Answer: Aggregate Navigation

Answer KeyLearners Guide

207

Quiz: Designing advanced objects


Page 57
1. True or False: You can use all database functionality over and above what is listed in the functions list in the Select and Where fields. Answer: True 2. List three different analytic(Transact-SQL) functions. Answer: RANK ( ) OVER (PARTITION BY) ROW_NUMBER ( ) OVER (PARTITION BY) SUM ( ) OVER (PARTITION BY) 3. True or False. The @select function is an internal function that allows you, as the designer, to reuse universe objects without forcing you to repeat the entire SQL syntax. Answer: True

208

Advanced Universe DesignLearners Guide

Quiz: Creating complex predefined conditions and LOVs


Page 84
1. True or false? Using subqueries allows you to use aggregate functions in the WHERE clause. Answer: True 2. When setting up a predefined condition that returns a pattern, what two important syntaxes are required to achieve this? Answer: LIKE and % 3. What functions cannot be used in a join definition? Answer: @select and @where

Answer KeyLearners Guide

209

Quiz: Securing universes


Page 99
1. Universe security can be managed at which levels? Answer: Connection credentials and data source Central Management Server Universe 2. True or False. Instead of denying access per universe file, you can group universes in folders and set appropriate access rights per folder. Answer: True. 3. True or False. When the Use Single Sign-On when refreshing reports at view time option is selected for a connection, all users in the CMS that need to use this connection will require having their database user credentials set in the CMS. Answer: False. This only applies to the Use BusinessObjects credential mapping option.

210

Advanced Universe DesignLearners Guide

Quiz: Implementing universe life cycle management


Page 116
1. True or False. When importing documents from a BIAR file, both the universe name and path are used for finding dependent documents. Answer: False. It uses CUID to find the dependencies. 2. True or False. The Import Wizard acts as a bridge between the source repository and target repository, or the CMS database. It can promote content between clusters on the same network (LAN or WAN). Answer: True. 3. True or False. When using the Import Wizard to promote an object from one BusinessObjects Enterprise XI 3.0/3.1 deployment to another, the wizard allows you to use either the objects CUID or its name and path to determine whether the object already exists on the destination environment. It also lets you specify what you want the wizard to do when it finds that an object already exists on the destination environment. Answer: True.

Answer KeyLearners Guide

211

Quiz: Maintaining and optimizing universes


Page 147
1. True or False. Adding new tables or columns to the database impacts the reports that are already created and refreshed regularly by end users. Answer: False. 2. True or False. In the case of a column name change, you only need to edit all the objects that referred to the original column. Answer: True. 3. True or False. Setting the FILTER_IN_FROM parameter to Yes moves the SELECT clause data of a query to the FROM clause. Answer: False.

212

Advanced Universe DesignLearners Guide

Quiz: Creating universes from other data sources


Page 169
1. What three tasks can you perform in the Metadata Exchange panel? Answer: Create a new universe from a metadata file. Update an existing universe when the metadata has been updated. Export a universe to a metadata format.

2. True or False. A stored procedure is a compiled SQL program, consisting of one or more SQL statements, which resides and runs on the target database. Answer: True. 3. True or False. When creating an OLAP universe, no tables are generated in the Structure pane. Answer: True. 4. True or False. Stored procedures are represented as Derived Tables, thus they benefit from Derived Table mechanisms and concepts. Answer: True.

Answer KeyLearners Guide

213

214

Advanced Universe DesignLearners Guide

Notes

Notes

Notes

Notes

Das könnte Ihnen auch gefallen