Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

BI Publihser Interview

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 23

PL/SQL support within Data Template separate the data extraction logic and XML generation in

two separate layers. We can hook the PL/SQL logic to implement the Business rules, Data
extraction or post processing logic. Through PL/SQL logic, we can push some of the complex
data calculation and network intensive operations  to Database layer.

Let's discuss following sample Data Template.  The data template has associated default plsql
package.

Default PL/SQL Package (emp_test1.pls)

CREATE OR REPLACE package emp_test1 as

DYNAMIC_WHERE_CLAUSE varchar2(3200);
P_DEPTNO varchar2(10);
P_SAL number;
P_HIRE_DATE date;
function BeforeReportTrigger return boolean;
function DeptGroupFilter (p_dept_number number ) return boolean;
function AfterReportTrigger (totalOrgsal number) return boolean;
END;
/
CREATE OR REPLACE
PACKAGE BODY emp_test1 AS
function BeforeReportTrigger return boolean IS
begin
IF (P_DEPTNO ='10') THEN
DYNAMIC_WHERE_CLAUSE :='D.DEPTNO =10';
ELSIF (P_DEPTNO ='20') THEN
DYNAMIC_WHERE_CLAUSE :='D.DEPTNO =20';
ELSIF (P_DEPTNO ='30') THEN
DYNAMIC_WHERE_CLAUSE :='D.DEPTNO =30';
ELSIF (P_DEPTNO ='40') THEN
DYNAMIC_WHERE_CLAUSE :='D.DEPTNO =40';
ELSE
DYNAMIC_WHERE_CLAUSE :='1=1';
END IF;
return true;
end;
FUNCTION AfterReportTrigger (totalOrgsal number) return boolean IS
BEGIN
 
INSERT INTO org_sal (report_date,total_sal_amount ) VALUES (sysdate,totalOrgsal);
commit;
return true;
END;
 
FUNCTION DeptGroupFilter (p_dept_number number) return boolean is
BEGIN
IF (p_dept_number='30') THEN
RETURN FALSE;
END IF;
RETURN TRUE;
end;
 
END;
/

PL/SQL logic should be implemented as single PL/SQL Package with following conditions.

1. All the parameters define in Parameter section of Data Template should be define as
parameters in plsql package.
2. PL/SQL logic should be implemented as function and must return a Boolean value.
3. The package should be define as defaultPackage attribute in Data Template Header.

In the above example, we see following three instance of PL/SQL call. Two dataTriggers and
one Group Filter

-<dataTrigger name="afterReport"
source="emp_test1.AfterReportTrigger(:ORG_TOTAL_SALARY)" /> 
-<dataTrigger name="beforeReport" source="emp_test1.BeforeReportTrigger" />

1) Before Report Trigger

The position of first dataTrigger is before the dataStructure section in Data Template. It gets fire
before the very first SQL query executes. In this example,  PL/SQL function 
BeforeReportTrigger drive the DYNAMIC_WHERE_CLAUSE variable based on
P_DEPTNO value. P_DEPTNO value will be available within plsql package as the process set
the value from data template parameters to pl/sql parameters. That is the reason; we need to
define the same set of parameters in PL/SQL as defined in data template. BeforeReportTrigger
function set the DYNAMIC_WHERE_CLAUSE parameter calue as “D.DEPTNO =10”. Before
executing the SQL query Q1, process replace the substitute variable
DYNAMIC_WHERE_CLAUSE with the actual values and following query get fired.

              SELECT d.DEPTNO,d.DNAME,d.LOC,


              EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM from DEPT D, EMP E  where
D.DEPTNO=E.DEPTNO
              and D.DEPTNO =10

PL/SQL parameter/s can be reference as substitute variables within SQL query and this feature
allow us to design the dynamic SQL query based on the input parameters.
The before report triggers can be used to designing dynamic SQL queries or filter conditions
using substitute variables,populating the temporary or global temporary tables for Oracle apps
for complex data extraction process and then write the SQL query against these temp tables.

2) After Report Trigger

The position of “afterReport” data trigger is after the dataStructure section and termed as after
Report Trigger. These triggers get fire after the XML generation complete. In our example
function “AfterReportTrigger” accept the ORG_TOTAL_SALARY  as input parameter and
insert a record to ORG_SAL table. 
 
The purpose of after report triggers is to implement any post process logic as cleaning or deleting
the temp tables or records, auditing activities.

3) Group Filter

The use of Group filter is to filter out the groups from the XML ouput, if the specified condition
implemented in calling function does not match. If the PL/SQL function returns the false, the
particular instance of group will not be the part of XML output.

In the example, DeptGroupFilter accept the dept_number element value as input. If the value is
30, it returns false and Group belongs to deptn0=30 will not be there in final xml.

I tried multiple before and aft er data triggers within the same data template and they executed
sequentially, So I  think we can use multiple before and after dataTriggers. All these three call
are simple PL/SQL functions and designed for some specific operations but there is no
restrictions on nature of PL/SQL logic inside the function, just make sure it return the
appropriate Boolean value.

Please feel free to ask any question on this topic and I will be happy to help you out.

Global Temporary Tables


Applications often use some form of temporary data store for processes that are to complicated
to complete in a single pass. Often, these temporary stores are defined as database tables or
PL/SQL tables. In Oracle 8i, the maintenance and management of temporary tables can be
delegated to the server by using Global Temporary Tables.

 Creation of Temporary Global Tables


 Miscellaneous Features
Creation of Global Temporary Tables
The data in a global temporary table is private, such that data inserted by a session can only be
accessed by that session. The session-specific rows in a global temporary table can be preserved
for the whole session, or just for the current transaction. The ON COMMIT DELETE ROWS clause
indicates that the data should be deleted at the end of the transaction.

CREATE GLOBAL TEMPORARY TABLE my_temp_table (


column1 NUMBER,
column2 NUMBER
) ON COMMIT DELETE ROWS;

In contrast, the ON COMMIT PRESERVE ROWS clause indicates that rows should be preserved until
the end of the session.

CREATE GLOBAL TEMPORARY TABLE my_temp_table (


column1 NUMBER,
column2 NUMBER
) ON COMMIT PRESERVE ROWS;

Miscellaneous Features
 If the TRUNCATE statement is issued against a temporary table, only the session
specific data is trucated. There is no affect on the data of other sessions.
 Data in temporary tables is automatically deleted at the end of the database session, even
if it ends abnormally.
 Indexes can be created on temporary tables. The content of the index and the scope of the
index is that same as the database session.
 Views can be created against temporary tables and combinations of temporary and
permanent tables.
 Temporary tables can have triggers associated with them.
 Export and Import utilities can be used to transfer the table definitions, but no data rows
are processed.
 There are a number of restrictions related to temporary tables but these are version
specific.

What is function

Package

Global Temp Table

Bookmarks in PDF

Excel Templates

Hierarchical Queries
Pragma Autonomous Transaction

Excel Templates

Integrating OBIEE with BI publisher

Multiple layouts

Difficult report in BIP

What forms of reports that you developed

Master- Detail Report

Fixed Number of Lines per page Report

Extext templates

BIP Admin Glance

OBIEE MUDE

OBIEE BUSINESS LAYER

VIEWS

MATERIALIZED VIEWS

DAC

INFORMATICA

Using XPath Commands


XPath is an industry standard developed by the World Wide Web Consortium (W3C). It is the
method used to navigate through an XML document. XPath is a set of syntax rules for
addressing the individual pieces of an XML document. You may not know it, but you have
already used XPath; RTF templates use XPath to navigate through the XML data at runtime.

This section contains a brief introduction to XPath principles. For more information, see the
W3C Web site: http://www.w3.org/TR/xpath
XPath follows the Document Object Model (DOM), which interprets an XML document as a
tree of nodes. A node can be one of seven types:

 root

 element

 attribute

 text

 namespace

 processing instruction

 comment

Many of these elements are shown in the following sample XML, which contains a catalog of
CDs:

<?xml version="1.0" encoding="UTF-8"?>


<! - My CD Listing - >
<CATALOG>
<CD cattype=Folk>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD cattype=Rock>
<TITLE>Hide Your Heart</TITLE>
<ARTIST>Bonnie Tylor</ARTIST>
<COUNTRY>UK</COUNTRY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
</CATALOG>

The root node in this example is CATALOG. CD is an element, and it has an attribute cattype.
The sample contains the comment My CD Listing. Text is contained within the XML document
elements.

Locating Data

Locate information in an XML document using location-path expressions.


A node is the most common search element you will encounter. Nodes in the example
CATALOG XML include CD, TITLE, and ARTIST. Use a path expression to locate nodes
within an XML document. For example, the following path returns all CD elements:

//CATALOG/CD

where

the double slash (//) indicates that all elements in the XML document that match the search
criteria are to be returned, regardless of the level within the document.

the slash (/) separates the child nodes. All elements matching the pattern will be returned.

To retrieve the individual TITLE elements, use the following command:

/CATALOG/CD/TITLE

This example will return the following XML:

<CATALOG>
<CD cattype=Folk>
<TITLE>Empire Burlesque</TITLE>
</CD>
<CD cattype=Rock>
<TITLE>Hide Your Heart</TITLE>
</CD>
</CATALOG>

Further limit your search by using square brackets. The brackets locate elements with certain
child nodes or specified values. For example, the following expression locates all CDs recorded
by Bob Dylan:

/CATALOG/CD[ARTIST="Bob Dylan"]

Or, if each CD element did not have an PRICE element, you could use the following expression
to return only those CD elements that include a PRICE element:

/CATALOG/CD[PRICE]

Use the bracket notation to leverage the attribute value in your search. Use the @ symbol to
indicate an attribute. For example, the following expression locates all Rock CDs (all CDs with
the cattype attribute value Rock):

//CD[@cattype="Rock"]

This returns the following data from the sample XML document:

<CD cattype=Rock>
<TITLE>Hide Your Heart</TITLE>
<ARTIST>Bonnie Tylor</ARTIST>
<COUNTRY>UK</COUNTRY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>

You can also use brackets to specify the item number to retrieve. For example, the first CD
element is read from the XML document using the following XPath expression:

/CATALOG/CD[1]

The sample returns the first CD element:

<CD cattype=Folk>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>

XPath also supports wildcards to retrieve every element contained within the specified node. For
example, to retrieve all the CDs from the sample XML, use the following expression:

/CATALOG/*

You can combine statements with Boolean operators for more complex searches. The following
expression retrieves all Folk and Rock CDs, thus all the elements from the sample:

//CD[@cattype="Folk"]|//CD[@cattype="Rock"]

The pipe (|) is equal to the logical OR operator. In addition, XPath recognizes the logical OR and
AND, as well as the equality operators: <=, <, >, >=, ==, and !=. For example, we can find all
CDs released in 1985 or later using the following expression:

/CATALOG/CD[YEAR >=1985]

Starting Reference

The first character in an XPath expression determines the point at which it should start in the
XML tree. Statements beginning with a forward slash (/) are considered absolute. No slash
indicates a relative reference. An example of a relative reference is:

CD/*

This statement begins the search at the current reference point. That means if the example
occurred within a group of statements the reference point left by the previous statement would be
utilized.
As noted earlier, double forward slashes (//) retrieve every matching element regardless of
location in the document, therefore the use of double forward slashes (//) should be used only
when necessary to improve performance.

Context and Parent

To select current and parent elements, XPath recognizes the dot notation commonly used to
navigate directories. Use a single period (.) to select the current node and use double periods (..)
to return the parent of the current node. For example, to retrieve all child nodes of the parent of
the current node, use:

../*

Therefore, to access all CDs from the sample XML, use the following expression:

/CATALOG/CD/..

You could also access all the CD tittles released in 1988 using the following:

/CATALOG/CD/TITLE[../YEAR=1988]

The .. is used to navigate up the tree of elements to find the YEAR element at the same level as
the TITLE, where it is then tested for a match against "1988". You could also use // in this case,
but if the element YEAR is used elsewhere in the XML document, you may get erroneous
results.

XPath is an extremely powerful standard when combined with RTF templates allowing you to
use conditional formatting and filtering in your template.

Namespace Support
If your XML data contains namespaces, you must declare them in the template prior to
referencing the namespace in a placeholder. Declare the namespace in the template using either
the basic RTF method or in a form field. Enter the following syntax:

<?namespace:namespace name= namespace url?>

For example:

<?namespace:fsg=http://www.oracle.com/fsg/2002-30-20/?>

Once declared, you can use the namespace in the placeholder markup, for example: <?
fsg:ReportName?>

Using XSL Elements


You can use any XSL element in your template by inserting the XSL syntax into a form field.

If you are using the basic RTF method, you cannot insert XSL syntax directly into your template.
BI Publisher has extended the following XSL elements for use in RTF templates.

To use these in a basic-method RTF template, you must use the BI Publisher Tag form of the
XSL element. If you are using form fields, use either option.

Apply a Template Rule

Use this element to apply a template rule to the current element's child nodes.

XSL Syntax: <xsl:apply-templates select="name">

BI Publisher Tag: <?apply:name?>

This function applies to <xsl:template-match="n"> where n is the element name.

Copy the Current Node

Use this element to create a copy of the current node.

XSL Syntax: <xsl:copy-of select="name">

BI Publisher Tag: <?copy-of:name?>

Call Template

Use this element to call a named template to be inserted into or applied to the current template.
For example, use this feature to render a table multiple times.

XSL Syntax: <xsl:call-template name="name">

BI Publisher Tag: <?call-template:name?>

Template Declaration

Use this element to apply a set of rules when a specified node is matched.

XSL Syntax: <xsl:template name="name">

BI Publisher Tag: <?template:name?>

Variable Declaration

Use this element to declare a local or global variable.


XSL Syntax: <xsl:variable name="name">

BI Publisher Tag: <?variable:name?>

Example:

<xsl:variable name="color" select="'red'"/>

Assigns the value "red" to the "color" variable. The variable can then be referenced in the
template.

Import Stylesheet

Use this element to import the contents of one style sheet into another.

Note: An imported style sheet has lower precedence than the importing style sheet.

XSL Syntax: <xsl:import href="url">

BI Publisher Tag: <?import:url?>

Define the Root Element of the Stylesheet

This and the <xsl:stylesheet> element are completely synonymous elements. Both are used to
define the root element of the style sheet.

Note: An included style sheet has the same precedence as the including style sheet.

XSL Syntax: <xsl:stylesheet xmlns:x="url">

BI Publisher Tag: <?namespace:x=url?>

Note: The namespace must be declared in the template. See Namespace Support.

Native XSL Number Formatting

The native XSL format-number function takes the basic format:

format-number(number,format,[decimalformat])
Parameter Description

number Required. Specifies the number to be formatted.

format Required. Specifies the format pattern. Use the following characters to specify the
pattern:

 # (Denotes a digit. Example: ####)

 0 (Denotes leading and following zeros. Example: 0000.00)

 . (The position of the decimal point Example: ###.##)

 , (The group separator for thousands. Example: ###,###.##)

 % (Displays the number as a percentage. Example: ##%)

 ; (Pattern separator. The first pattern will be used for positive numbers and
the second for negative numbers)

decimalformat Optional. For more information on the decimal format please consult any basic XSLT
manual.

Using FO Elements
You can use the native FO syntax inside the Microsoft Word form fields.

For more information on XSL-FO see the W3C Website at


http://www.w3.org/2002/08/XSLFOsummary.html

The full list of FO elements supported by BI Publisher can be found in the Appendix: Supported
XSL-FO Elements.

Guidelines for Designing RTF Templates for Microsoft


PowerPoint Output
BI Publisher can generate your RTF template as PowerPoint output enabling you to get report
data into your key business presentations. Currently, the PowerPoint document generated is a
simple export of the formatted data and charts to PowerPoint.

Limitations

Following are limitations when working with PowerPoint as an output:

 When designing tables for your PowerPoint slide, you must define the table border type
as a single line (double border, dash, and other types are not supported).
 Hyperlinks are not supported.

 Shapes are not supported.

 Text position may be slightly incorrect if you use right-align.

 Paper size must be the same on all pages of the RTF template. You cannot have mixed
paper sizes in the same document.

 Bidirectional languages are not supported.

 Text position may be slightly incorrect for Chinese, Japanese, and Korean fonts when
using bold or italic effects on characters. This is because Microsoft uses bold or italic
emulation when there is no bold or italic font.

 All Unicode languages, except bidirectional languages, are supported.

 BI Publisher's font fallback mechanism is not supported for PowerPoint templates. If you
wish to use a font that is not installed, ensure that you have configured it with BI
Publisher.

MUD IN OBIEE

Lets start with the simple diagram below.

      
The above diagram illustrates how the MUD works. In order for
the MUD to work following are the pre-requisites
1.   A shared drive to host the Master Repository
2.   All the client machines should have access to the master
repository.
3.   All the client machines should have the admin tool installed.
For the MUD to work, the repository that is worked upon by all
the users should be kept in a shared directory. This shared
directory should be accessible to all the users. In each of the
client’s Admin tool, enter the Shared Directory path.

      
Now, open the Master repository in offline mode. The entire
concept of MUD revolves around objects called as Projects. So,
from within the Admin tool navigate to Manage – Projects.

      
This will open up a project window. Projects are basically
subsets of objects within the Admin tool that can be assigned to
individual users. So, the idea is to assign different projects to
different users. Also, each of these projects can contain one or
more Logical Fact tables. As soon as a logical fact table is
included all the other dependent objects would automatically be
part of the project. Typically when we start with a repository, we
would not be having any BM or presentation layers. So, it is
recommended that one imports all the physical tables and
creates the physical joins in the repository first before
implementing MUD. After that we can create dummy BM and
presentation layers so that they can be assigned to individual
projects. Also, one can assign Users, Init Blocks and Variables
to a project.

      
After creating and assigning objects to a project, the next step is
to save the master repository in a shared drive. Now, open up a
client Admin tool and navigate to File – Multiuser – Checkout.
This Check out process does 2 things
1.   Copies the Master repository from the shared drive to the
local drive ( This will serve as the local master repository).
2.   Gives you a screen to choose the project that you have the
authority to work on.
3.   Creates a subset repository (would ask you to enter the
name) which would contain only the selected project related
data.
So, basically the idea is to work on the subset repository (like
creating/deleting dimensions, hierarchies etc) and then merge
the changes back to the local master repository. The merge
process will lock the master repository in the shared drive. In
order to release the lock one would have to Choose “Publish to
Network” which will copy the modified and merged local
master repository to the shared drive. The process would be the
same for all the other users.

Overview of Oracle BI Repository Three-Way Merge


By default, the Oracle BI repository development environment is not set up for multiple users.
However, online editing makes it possible for multiple developers to work simultaneously,
though this may not be an efficient methodology, and can result in conflicts, because developers
can potentially overwrite each other's work.

A more efficient development environment would permit developers to modify a repository


simultaneously and then check in changes. This can be done by setting up the multiuser
environment using the Oracle BI Administration Tool to support concurrent development.

For example :

 after completing an implementation, the administrator may want to deploy Oracle BI to other
functional areas of the company. In this example, multiple developers need to work
concurrently on subsets of the metadata and merge these subsets back into a master repository
without their work conflicting with that of the other developers.
 in other organizations, a single developer might manage all development. For simplicity and
performance, this developer might want to use a multiuser development environment (MUDE)
to maintain metadata code in smaller chunks instead of in a large repository.

The Oracle BI repository development process adheres to the classic Software Configuration
Management (SCM) process, which utilizes a three-way merge to manage concurrent
development. Changes are managed by merge and reconciliation.

Most of the merging process is automatic, and changes do not conflict.

In case of any conflicts, developers can manually resolve them. The merge creates a final
“merged” file based on two changed files, which are base-lined against a common parent file.
This enables developers to work simultaneously on repository development. Developers manage
this process using the utilities and interfaces provided in the BI Administration Tool. Changes
are managed by merge and reconciliation. The merge creates a final, “merged” file based on two
changed files, which are base-lined against a common parent file. Oracle BI repository is stored
as an rpd file. Developers check out the file and make changes locally. Changes are then merged
into a final, merged repository (rpd) file.

Articles Related
 OBIEE - Repository (RPD)

Concept
The MUD environment is done by creating Projects in the repository file in the BI
Administration Tool and then copying this repository file to a shared network directory.
Developers can check out projects, make changes, and then merge the changes into the master
repository.

The entire concept of MUD (MutliUser Development) revolves around objects called as Projects.
Projects are subsets of objects based on logical fact table that can be assigned to individual users.
So, the idea is to assign different projects to different users. Also, each of these projects can
contain one or more Logical Fact tables. As soon as a logical fact table is included all the other
dependent objects would automatically be part of the project.

How to start
To start, we must :

 create a repository and assign objects to a project


 setting up the repository in a shared directory
Create a first project in the master repository

Typically when we start with a repository, we would not be having any Business Model or
presentation layers.

So, to be able to assign objects to projects, we must create a dummy environment by :

 importing all the physical tables and creates the physical joins
 creating a dummy Business Model and then a dummy presentation layers
 creating Users, Init Blocks and Variables.

After performing this steps, we can finally create a project.

Setting up the master repository in a shared directory

For performing this step, you must :

 create a shared directory


 copy the repository just created above
 setting the options in the multiuser tab (the shared directory and your name basically).

Check out / Check in


So, basically the idea is to work on the subset repository (like creating/deleting dimensions,
hierarchies etc) and then merge the changes back to the local master repository. The merge
process will lock the master repository in the shared drive. In order to release the lock one would
have to Choose “Publish to Network” which will copy the modified and merged local master
repository to the shared drive. The process would be the same for all the other users.

Check out

In the Oracle BI Administration Tool, select File > Multiuser > Checkout.

You will see then the project where you have right.

Select on which project you want to work and the process purpose you to save it in a subset
repository.
If you have a problem on this step
* check that you have all right
* you can create a dummy file

After saving the subset, you will see 2 repository files in your local repository directory
(OBI_Home\server\Repository) :

 your subset
 the original file that have be automatically generated with the name
original_your_subset_file_name

Check In

To ckeck in, you have to :

 merge the modifications


 verify the consistency of the new master repository
 publish or cancel your modifications according to the previsou step.

To merge the modifications, Select File > Multiuser > Merge Local Changes. This merges your
changes to the shared repository.
Select ok. The next screen let you the possibilities to describe your modification. This
information will be available in the history management.

A merge screen appears. You will may be have conflicts with other user and you must resolve
them. See the merge process in detail to more details.
In the Shared directory, you can see that an additional file MasterRepository.lck appears in the
directory; this is the lock file, which is created when the shared repository is locked. Also, when you
navigate to OBI_HOME\server\Repository you can see that subset.rpd and subset.log are generated.

No other user can check in projects while the shared repository is locked. You must release it by
publishing it.

If you try to close the repository (File > Close to close the repository). A warning appears indicating that
you are closing an MUD repository without publishing or discarding your local changes, so the lock on
the repository has not been released.
At this point, you have the option to :
* publish the repository (copy the local copy of the shared repository to the server),
* discard the local changes,
* or close the repository and keep the lock.

To publish (unlock the master repository, you must publish it (Select File > Multiuser > Publish
to Network). The local copy of the shared repository is merged with the shared repository and
then closed and deleted.

History
Select File > Multiuser > History. Log in. The several version of the master repository is opened
and the history of changes is displayed.

You might also like