Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Oracle Essbase 11 Development Cookbook

You're reading from   Oracle Essbase 11 Development Cookbook Over 90 advanced development recipes to build and take your Oracle Essbase Applications further with this book and ebook

Arrow left icon
Product type Paperback
Published in Jan 2012
Publisher Packt
ISBN-13 9781849683265
Length 400 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Jose R Ruiz Jose R Ruiz
Author Profile Icon Jose R Ruiz
Jose R Ruiz
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Oracle Essbase 11 Development Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Understanding and Modifying Data Sources 2. Using Essbase Studio FREE CHAPTER 3. Building the BSO Cube 4. Building the ASO Cube 5. Using EAS for Development 6. Creating Calculation Scripts 7. Using MaxL to Automate Process 8. Data Integration 9. Provisioning Security Using MaxL Editor or Shared Services 10. Developing Dynamic Reports Index

Adding and populating the Sort Order Column


In previous releases of Essbase, a developer had the option of building a hierarchy in ascending or descending alphabetical order via a build rule. If you wanted to sort the hierarchies in a different order, then you would go into Essbase Administrative Services (EAS). Then, open the outline, and drag and drop the members in the order that the business wanted or extract the dimension using an Outline Extract utility, sort the hierarchy, and use a build rule to rebuild the dimension. In contrast, when we are using Essbase Studio, in version 11.1.2.1, we are going to have to define the Sort Order in the relational environment. If you have the Oracle's data-governance software Data Relationship Management (DRM), this task will be handled there, but this recipe shows you how to load the Sort Order field with some SQL knowledge and Excel.

Getting ready

To get started, open SQL Server Management Studio, and add a database called TBC, if you have not already done it. In this recipe, we are using T-SQL and providing the PL\SQL equivalent where the syntax is different. You need to add a SCHEMA instead and use a tool like TOAD or Golden, if you are using Oracle. You should also open an Excel workbook.

How to do it...

  1. Execute the following query to create the YEARS table. We can change the script below to PL/SQL by replacing int with INTEGER and varchar() with VARCHAR2():

    --For T-SQL user
    Create Table YEARS(
      YEARID       int         NOT NULL,
      YEAR         int         NULL,
      QUARTER      varchar(80)     NULL,
      MONTH        varchar(80)     NULL,
      MONTH_ALIAS  varchar(80)     NULL,
      Constraint PK_YEAR_YEARID Primary Key(YEARID Asc)
    ); 
  2. Execute the following script to add the SORT_ORDER column:

    --This is the syntax in T-SQL
    Alter Table YEARS Add SORT_ORDER INT NULL;
    --This is the syntax in PL/SQL
    Alter Table YEARS Add SORT_ORDER INTEGER NULL;
  3. Open Excel and enter the YEARS dimension's data starting with field A1, as follows:

  4. Sort the hierarchy manually, if it does not look right in the order specified in the preceding screenshot. Enter the number 1 in cell F1 and formula =F1+1 in cell F2.

  5. Click on cell F2, then click on the box to the right and bottom of the cell, and drag it down to cell F12.

  6. Enter the following concatenation string in cell G1, select G1, and press CTRL+C. Select range G2:G12, and press CTRL+V to paste the concatenation string:

    ="Insert Into TIME Values (" & A1 & ", " & B1 & ", '"& C1 & "', '" & D1 & "', '" & E1 & "', '" & F1 & "');"
  7. Copy range G1:G12, open up SQL Management Studio, connect to the TBC database, paste the range in the query window, and execute the following queries:

    Insert Into YEARS Values(1, 2011, 'QTR1 11', 'Jan 2011', 'January 2011', '1');
    Insert Into YEARS Values(2, 2011, 'QTR1 11', 'Feb 2011', 'February 2011', '2');
    Insert Into YEARS Values(3, 2011, 'QTR1 11', 'Mar 2011', 'March 2011', '3');
    Insert Into YEARS Values(4, 2011, 'QTR2 11', 'Apr 2011', 'April 2011', '4');
    Insert Into YEARS Values(5, 2011, 'QTR2 11', 'May 2011', 'May 2011', '5');
    Insert Into YEARS Values(6, 2011, 'QTR2 11', 'Jun 2011', 'June 2011', '6');Insert Into YEARS Values(7, 2011, 'QTR3 11', 'Jul 2011', 'July 2011', '7');
    Insert Into YEARS Values(8, 2011, 'QTR3 11', 'Aug 2011', 'August 2011', '8');
    Insert Into YEARS Values(9, 2011, 'QTR3 11', 'Sep 2011', 'September 2011', '9');
    Insert Into YEARS Values(10, 2011, 'QTR4 11', 'Oct 2011', 'October 2011', '10');
    Insert Into YEARS Values(11, 2011, 'QTR4 11', 'Nov 2011', 'November 2011', '11');
    Insert Into YEARS Values(12, 2011, 'QTR4 11', 'Dec 2011', 'December 2011', '12'); 
    

How it works...

The following are the steps in this recipe:

  1. We added the YEARS table to the TBC database.

  2. We added the SORT_ORDER column to the YEARS table.

  3. We added an integer used to sort the members.

  4. We also entered the YEARS dimension into an Excel sheet and sorted our YEARS hierarchy.

  5. After placing the SORT_ORDER into column F1, we pasted the correct SORT_ORDER and concatenate Insert statements together with the values in Excel.

  6. Finally, we used the Insert statements in the Excel workbook to update the YEARS table using the SQL Management Studio.

The following is what your YEARS hierarchy should look like without the SORT_ORDER column:

2011

  
 

QTR1 11

 
  

Feb 2011

  

Jan 2011

  

Mar 2011

 

QTR2 11

 
  

Apr 2011

  

Jun 2011

  

May 2011

 

QTR3 11

 
  

Aug 2011

  

Jul 2011

  

Sep 2011

 

QTR4 11

 
  

Dec 2011

  

Nov 2011

  

Oct 2011

Essbase Studio will enter February into the outline before January, May will be after June, August will be before July, and the fourth quarter will be completely out of order. For this reason, it is suggested that you add a SORT_ORDER column to all of your dimension tables.

See also

Refer to the Using Sort Order on data elements recipe in Chapter 2 to learn how to set the sort order for your metadata elements.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image