<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Oracle Developer &#187; Tutorial</title>
	<atom:link href="http://www.oracledeveloper.info/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.oracledeveloper.info</link>
	<description>Development Ideas, Thoughts and Solutions</description>
	<lastBuildDate>Thu, 18 Feb 2010 13:02:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Downgrading from OBIEE to OBISE1</title>
		<link>http://www.oracledeveloper.info/downgrading-from-obiee-to-obise1/</link>
		<comments>http://www.oracledeveloper.info/downgrading-from-obiee-to-obise1/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 12:25:45 +0000</pubDate>
		<dc:creator>Oracle Developer</dc:creator>
				<category><![CDATA[RPD]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.oracledeveloper.info/?p=477</guid>
		<description><![CDATA[A number of times I&#8217;ve worked on projects where the client is using Oracle Business Intelligence Standard Edition One (OBISE1) but have not had the time or resources to install development and production versions of the application. Thus, other than developing on the production OBISE1 installation I&#8217;ve had to develop on my own application, which [...]]]></description>
			<content:encoded><![CDATA[<p>A number of times I&#8217;ve worked on projects where the client is using Oracle Business Intelligence Standard Edition One (OBISE1) but have not had the time or resources to install development and production versions of the application. Thus, other than developing on the production OBISE1 installation I&#8217;ve had to develop on my own application, which happens to be OBIEE.</p>
<p>Oracle basically sellls the two versions as one being the entry level version (OBISE1) and the second being the &#8216;all dancing&#8217; enterprise version (OBIEE). Theoretically they are the same except that OBISE1 hasn&#8217;t all the functionality as OBIEE. A user can very happily start with OBISE1 and when the time comes that they need more functionality or need to upgrade their license for more users then they can seemlessly switch to the enterprise edition, OBIEE.</p>
<p>Logically it would make sense that the two versions are the same, except that OBISE1 has some of the functionality disabled. Logic doesn&#8217;t always work in business and it turns out that they are not the same. In fact, they are different versions of thee same tool, OBISE1 being an older version than OBIEE. And it is this fact that makes developing in OBIEE and moving the rpd repositiory to OBISE1 interesting.<br />
<span id="more-477"></span></p>
<p>Why? Because when we move the repository from OBIEE to OBISE1 we are actually downgrading the rpd file. You don&#8217;t do this with software. You always upgrade from an older version to a newer version, never downgrade. It is quite seemless to develop an rpd in OBISE1 and upgrade it to OBIEE. Oracle supply the tools to do this. However, Oracle do not recognise &#8211; or support -moving an rpd file from OBIEE to OBISE1. If you check Oracle Metalink they say it is not possible.</p>
<p>However, it is possible, and actually quite easy to do. Siebel supplied tools with Siebel Analytics which enabled this and these same tools can be used with OBISE1 and OBIEE. There is one proviso though. If you are going to move an OBIEE repository to OBISE1 then you must ensure that you are not using any of the functionality that is only available in OBIEE. If you are then this will not work and when you open the repository in OBISE1 all you will get are errors.</p>
<p>The following steps guide you though downgrading a repository from OBIEE to OBISE1. For this example I am using the repository sh.rpd.</p>
<h3 class="sectionHeading">Step 1</h3>
<p>Go to the directory where the rpd file is e.g.</p>
<p>C:\OracleBI\server\Repository</p>
<h3 class="sectionHeading">Step 2</h3>
<p>Make a backup of the existing sh.rpd file to sh_backup.rpd</p>
<h3 class="sectionHeading">Step 3</h3>
<p>Open up the command prompt and go to the repository directory.</p>
<pre class="plsqlCode">C:\&gt;cd C:\OracleBI\server\Repository

C:\OracleBI\server\Repository&gt;</pre>
<h3 class="sectionHeading">Step 4</h3>
<p>Run the following command:</p>
<pre class="plsqlCode">C:\OracleBI\server\bin\nQUDMLGen -U Admin -P Admin -R sh.rpd -O sh.txt</pre>
<p>where:</p>
<p>-U is the repository user<br />
-P is the repository password<br />
-R is the name of the repository rpd file<br />
-O is the name of the text output file that is being created</p>
<p>It will take a few seconds but if all is successful you will get a new command line prompt and no errors.</p>
<h3 class="sectionHeading">Step 5</h3>
<p>The following file, sh.txt, should have been created in the repository directory.</p>
<h3 class="sectionHeading">Step 6</h3>
<p>Open the sh.txt file in a text editor and search for the line containing the repository version. e.g.<br />
VERSION 1.1.184;</p>
<p>Change this line to the OBISE1 version number, e.g.<br />
VERSION 1.1.171;</p>
<p>Save the sh.txt file.</p>
<p>If you are not sure what the OBISE1 version number should be there are a number of ways of doing this. You can either run nQUDMLGen.exe program against an OBISE1 rpd file and check the version number in it.<br />
Alternatively, you can go to the OBISE1 Oracle BI Adminstration Tool. Go to the menu &#8216;File New&#8217; and create a new repository (*.rpd) file. Then go to &#8216;Help&#8217; &#8211;&gt; &#8216;About Administration Tool &#8230;&#8217; which will open up a popup similar to this.</p>
<div id="attachment_493" class="wp-caption alignnone" style="width: 406px"><img class="size-full wp-image-493 " title="OBIEE Repository About Administration Tool Popup" src="http://img.oracledeveloper.info/2010/02/About-Administration-Tool.png" alt="About Administration Tool" width="396" height="191" /><p class="wp-caption-text">OBIEE Repository About Administration Tool Popup</p></div>
<p>You can see that the Repository Version number is displayed. In the above screenshot it is the OBIEE repository version number of &#8216;184&#8242;. For OBISE1 it will probably be &#8216;171&#8242;. Whatever number is displayed; use this number prefixed by &#8216;1.1.&#8217; So if the Repository Version number is &#8216;171&#8242; then the number you will use in the sh.txt file will be &#8216;1.1.171&#8242;.</p>
<h3>Step 7</h3>
<p>Rename the file sh.txt to sh_obise1.txt.</p>
<h3>Step 7</h3>
<p>Copy the file sh_obise1.txt from the OBIEE repository directory to the repository directory of the target machine. i.e. the directory where the OBISE1 repository files are stored. e.g.</p>
<pre class="plsqlCode">C:\OracleBISE1\server\Repository&gt;</pre>
<h3 class="sectionHeading">Step 8</h3>
<p>If you haven&#8217;t done so already, open up the command prompt and go to the OBISE1 repository directory</p>
<pre class="plsqlCode">C:\OracleBISE1\server\Repository&gt;</pre>
<h3 class="sectionHeading">Step 9</h3>
<p>Run the following command:</p>
<pre class="plsqlCode">C:\OracleBISE1\server\bin\nQUDMLExec -U Admin -P Admin -I sh_obise1.txt -O sh_obise1.rpd</pre>
<p>where:</p>
<p>-U is the repository user<br />
-P is the repository password<br />
-I is the name of the repository text input file<br />
-O is the name of the rpd output file that is being created</p>
<p>It will take a few seconds but if all is successful you should see the following.</p>
<pre class="plsqlCode">C:\OracleBISE1\server\Repository&gt;C:\OracleBI\server\bin\nQUDMLExec -U Admin -P Admin -I sh_obise1.txt -O sh_obise1.rpd

---------------sh_obise1.txt---------------

Complete success!!!

C:\OracleBISE1\server\Repository&gt;</pre>
<h3 class="sectionHeading">Step 10</h3>
<p>A new repositry file, sh_obise1.rpd,  should have been created.</p>
<h3 class="sectionHeading">Step 11</h3>
<p>Stop OBISE1 OC4J.</p>
<h3 class="sectionHeading">Step 12</h3>
<p>Stop the OBISE1 Oracle BI Services.</p>
<h3 class="sectionHeading">Step 13</h3>
<p>In the OBISE1 repository directory make a backup of your current sh.rpd file if there is one.</p>
<h3 class="sectionHeading">Step 14</h3>
<p>Rename the sh_obise1.rpd to sh.rpd.</p>
<h3 class="sectionHeading">Step 15</h3>
<p>Start OBISE1 OC4J</p>
<h3 class="sectionHeading">Step 16</h3>
<p>Start the OBISE1 Oracle BI Services</p>
<h3 class="sectionHeading">Step 17</h3>
<p>Go to the OBISE1 presentation services and check if the new sh.rpd repository is being used.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oracledeveloper.info/downgrading-from-obiee-to-obise1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OBI Answers: Drill Down to a Different Report</title>
		<link>http://www.oracledeveloper.info/obi-answers-drill-down-to-a-different-report/</link>
		<comments>http://www.oracledeveloper.info/obi-answers-drill-down-to-a-different-report/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 20:11:40 +0000</pubDate>
		<dc:creator>Oracle Developer</dc:creator>
				<category><![CDATA[OBI Answers]]></category>
		<category><![CDATA[Oracle Business Intelligence]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.oracledeveloper.info/?p=433</guid>
		<description><![CDATA[With the correct heirarchy setup in the Business Model and Mapping area an Answers report will drill down to each successive level. Each level logically being a child of the previous level. However, what happens if we&#8217;d like to drill down to data that isn&#8217;t part of a heirarchy but is logically child data? In [...]]]></description>
			<content:encoded><![CDATA[<p>With the correct heirarchy setup in the Business Model and Mapping area an Answers report will drill down to each successive level. Each level logically being a child of the previous level. However, what happens if we&#8217;d like to drill down to data that isn&#8217;t part of a heirarchy but is logically child data? In that case we need to use guided navigation to obtain our results.</p>
<p>In this tutorial we will produce a report which details the total amount sold throughout the world in each city of each country. We then want to drill down into the city to find a detailed breakdown of all the products which were sold in that city.</p>
<p>To start we need to produce the 2 reports we want. After that we can then add the guided navigation to enable us to drill down into the detailed report.<span id="more-433"></span></p>
<h3 class="sectionHeading">Step 1</h3>
<p>The first report we will produce is the parent report. We will call this &#8216;Sales by Country and City&#8217;. It will contain the following columns.</p>
<div id="attachment_437" class="wp-caption alignnone" style="width: 275px"><img class="size-full wp-image-437" title="Sales By Country And City Columns" src="http://img.oracledeveloper.info/2010/01/sales_by_country_and_city_columns.png" alt="Sales By Country And City Columns" width="265" height="74" /><p class="wp-caption-text">Sales By Country And City Columns</p></div>
<h3 class="sectionHeading">Step 2</h3>
<p>Tidied up and run the report will look like this.</p>
<div id="attachment_438" class="wp-caption alignnone" style="width: 251px"><img class="size-full wp-image-438 " title="Sales By Country And City" src="http://img.oracledeveloper.info/2010/01/sales_by_country_and_city_results.png" alt="Sales By Country And City Results" width="241" height="366" /><p class="wp-caption-text">Sales By Country And City</p></div>
<h3 class="sectionHeading">Step 3</h3>
<p>If we click on &#8216;Buenos Aires&#8217; we drill down to a list of sales for each customer from Buenos Aires.</p>
<div id="attachment_439" class="wp-caption alignnone" style="width: 326px"><img class="size-full wp-image-439" title="Sales By Country And City Drilling Down to Buenos Aires" src="http://img.oracledeveloper.info/2010/01/sales_by_country_and_city_drilldown.png" alt="Sales By Country And City Drilling Down to Buenos Aires" width="316" height="174" /><p class="wp-caption-text">Sales By Country And City Drilling Down to Buenos Aires</p></div>
<h3 class="sectionHeading">Step 4</h3>
<p>Next we create the child report.</p>
<div id="attachment_441" class="wp-caption alignnone" style="width: 433px"><img class="size-full wp-image-441 " title="Product Sales" src="http://img.oracledeveloper.info/2010/01/products_sold.png" alt="Products Sold" width="423" height="75" /><p class="wp-caption-text">Product Sales</p></div>
<h3 class="sectionHeading">Step 5</h3>
<p>With a few minor changes the report will look like this.</p>
<div id="attachment_444" class="wp-caption alignnone" style="width: 568px"><img class="size-full wp-image-444" title="Products Sold" src="http://img.oracledeveloper.info/2010/01/products_sold_report.png" alt="Products Sold" width="558" height="306" /><p class="wp-caption-text">Products Sold</p></div>
<h3 class="sectionHeading">Step 6</h3>
<p>The next thing we need to do is add filters to the products sold report. This is because we only want to display the products sold in a specific city. Ctrl click &#8216;Cust City&#8217; in the left-hand panel to add city as a filter condition. To test it works okay set the value to &#8216;Buenos Aires&#8217;.</p>
<div id="attachment_447" class="wp-caption alignnone" style="width: 241px"><img class="size-full wp-image-447" title="City Filter" src="http://img.oracledeveloper.info/2010/01/filter_city_buenos_aires.png" alt="City Filter" width="231" height="104" /><p class="wp-caption-text">City Filter</p></div>
<h3 class="sectionHeading">Step 7</h3>
<p>Two cities may have the same name in different countries, so add a country filter also. To test set the value to &#8216;Argentina&#8217;.</p>
<div id="attachment_448" class="wp-caption alignnone" style="width: 243px"><img class="size-full wp-image-448" title="Country Filter" src="http://img.oracledeveloper.info/2010/01/filter_country_argentina.png" alt="Country Filter" width="233" height="99" /><p class="wp-caption-text">Country Filter</p></div>
<h3 class="sectionHeading">Step 8</h3>
<p>The reports should now have two filters set.</p>
<div id="attachment_449" class="wp-caption alignnone" style="width: 316px"><img class="size-full wp-image-449" title="Country and City Filters" src="http://img.oracledeveloper.info/2010/01/filters_country_and_city.png" alt="Country and City Filters" width="306" height="55" /><p class="wp-caption-text">Country and City Filters</p></div>
<h3 class="sectionHeading">Step 9</h3>
<p>When run, the report should look like this.</p>
<div id="attachment_450" class="wp-caption alignnone" style="width: 501px"><img class="size-full wp-image-450" title="Product Sales In Buenos Aires" src="http://img.oracledeveloper.info/2010/01/product_sales_in_buenos_aires.png" alt="Product Sales In Buenos Aires" width="491" height="348" /><p class="wp-caption-text">Product Sales In Buenos Aires</p></div>
<h3 class="sectionHeading">Step 10</h3>
<p>We now need to call the &#8216;Product Sales&#8217; report from the &#8216;Sales by Country and City&#8217; report. Go to the Criteria tab of the &#8216;Sales by Country and City&#8217; report and click on the column properties icon <img class="alignnone size-full wp-image-456" title="Column Properties Icon" src="http://img.oracledeveloper.info/2010/01/column_properties_icon.png" alt="Column Properties Icon" width="14" height="14" /> of the Customers.&#8221;Cust City&#8221; column. Select the &#8216;Column Format&#8217; tab and change &#8216;Value Interaction&#8217; to &#8216;Navigate&#8217;.</p>
<div id="attachment_457" class="wp-caption alignnone" style="width: 385px"><img class="size-full wp-image-457" title="Value Interaction" src="http://img.oracledeveloper.info/2010/01/value_interaction_to_navigate.png" alt="Value Interaction" width="375" height="111" /><p class="wp-caption-text">Value Interaction</p></div>
<h3 class="sectionHeading">Step 11</h3>
<p>Click on the &#8216;Add Navigation Target&#8217; button and set &#8216;Target&#8217; to the &#8216;Product Sales&#8217; report.</p>
<div id="attachment_458" class="wp-caption alignnone" style="width: 381px"><img class="size-full wp-image-458" title="Value Interaction" src="http://img.oracledeveloper.info/2010/01/value_interaction_navigation.png" alt="Value Interaction" width="371" height="114" /><p class="wp-caption-text">Value Interaction</p></div>
<p>Then click OK.</p>
<h3 class="sectionHeading">Step 12</h3>
<p>Now run the &#8216;Sales by Country and City&#8217; report. This time when we click on &#8216;Buenos Aires&#8217; we get the &#8216;Product Sales&#8217; report filtered on the city &#8216;Buenos Aires&#8217;. Now click on the city &#8216;Sao Jose dos Campos&#8217; in Brazil. We get the following.</p>
<div id="attachment_460" class="wp-caption alignnone" style="width: 427px"><img class="size-full wp-image-460" title="Product Sales in Sao Jose dos Campos" src="http://img.oracledeveloper.info/2010/01/product_sales_in_sao_jose_dos_campos.png" alt="Product Sales in Sao Jose dos Campos" width="417" height="90" /><p class="wp-caption-text">Product Sales in Sao Jose dos Campos</p></div>
<p>Although this is what we were aiming to achieve the results are a little confusing. Unless somebody tells me otherwise I think this is a bug with OBIEE. The reason being is because we set and saved a filter on the &#8216;Product Sales&#8217; report to display only product sales in Buenos Aires. Clearly OBIEE has changed this filter to now display product sales in Sao Jose dos Campos instead!</p>
<h3 class="sectionHeading">Step 13</h3>
<p>We will now change the filters on the &#8216;Product Sales&#8217; report to work correctly (i.e. how they should be set if we are calling a child report from a parent report). Go to the &#8216;Criteria&#8217; tab of the &#8216;Product Sales&#8217; report and click on the filter options <img class="alignnone size-full wp-image-461" title="Filter Options" src="http://img.oracledeveloper.info/2010/01/filter_options_icon.png" alt="Filter Options" width="15" height="14" /> button for the &#8216;Cust City&#8217; filter. Select &#8216;Edit Filter&#8217;.</p>
<div id="attachment_462" class="wp-caption alignnone" style="width: 153px"><img class="size-full wp-image-462" title="Edit Filter" src="http://img.oracledeveloper.info/2010/01/edit_filter.png" alt="Edit Filter" width="143" height="133" /><p class="wp-caption-text">Edit Filter</p></div>
<h3 class="sectionHeading">Step 14</h3>
<p>Click on the &#8216;Operator&#8217; selection list.</p>
<div id="attachment_463" class="wp-caption alignnone" style="width: 236px"><img class="size-full wp-image-463" title="Operator Selection List" src="http://img.oracledeveloper.info/2010/01/create_edit_filter_operator.png" alt="Operator Selection List" width="226" height="326" /><p class="wp-caption-text">Operator Selection List</p></div>
<p>Change &#8216;is equal to / is in&#8217; to &#8216;is prompted&#8217;. Delete &#8216;Buenos Aires&#8217; from the &#8216;Value&#8217; field.</p>
<div id="attachment_465" class="wp-caption alignnone" style="width: 227px"><img class="size-full wp-image-465" title="Operator Is Prompted" src="http://img.oracledeveloper.info/2010/01/create_edit_filter_operator_is_prompted.png" alt="Operator Is Prompted" width="217" height="95" /><p class="wp-caption-text">Operator Is Prompted</p></div>
<p>Click OK.</p>
<h3 class="sectionHeading">Step 15</h3>
<p>Do the same for the &#8216;Country&#8217; filter.</p>
<h3 class="sectionHeading">Step 16</h3>
<p>Save the report and run it. The report should now show all records as though there were no filter set.</p>
<h3 class="sectionHeading">Step 17</h3>
<p>Now run the &#8216;Sales by Country and City&#8217; report again. Click on the city &#8216;San Nicolas&#8217; in Argentina. The &#8216;Product Sales&#8217; report should be filtered for the city &#8216;San Nicolas&#8217;.</p>
<div id="attachment_466" class="wp-caption alignnone" style="width: 453px"><img class="size-full wp-image-466" title="Product Sales in San Nicolas" src="http://img.oracledeveloper.info/2010/01/product_sales_in_san_nicolas.png" alt="Product Sales in San Nicolas" width="443" height="227" /><p class="wp-caption-text">Product Sales in San Nicolas</p></div>
<h3 class="sectionHeading">Step 18</h3>
<p>Test the report works for other cities. Click on &#8216;Buenos Aires&#8217; or &#8216;Sao Jose dos Campos&#8217; and see if we get the same results as before.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oracledeveloper.info/obi-answers-drill-down-to-a-different-report/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OBI Answers: User Defined Functions</title>
		<link>http://www.oracledeveloper.info/obi-answers-user-defined-functions/</link>
		<comments>http://www.oracledeveloper.info/obi-answers-user-defined-functions/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 13:38:28 +0000</pubDate>
		<dc:creator>Oracle Developer</dc:creator>
				<category><![CDATA[OBI Answers]]></category>
		<category><![CDATA[Oracle Business Intelligence]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.oracledeveloper.info/?p=402</guid>
		<description><![CDATA[As well as calling any of the Oracle predefined functions you can also create and use your own user defined functions in OBI Answers.
For this example we will create a function that formats a customer&#8217;s name and use this function in a report.
Step 1
First we will create a simple report.
Step 2
When run, the report looks [...]]]></description>
			<content:encoded><![CDATA[<p>As well as calling any of the Oracle predefined functions you can also create and use your own user defined functions in OBI Answers.</p>
<p>For this example we will create a function that formats a customer&#8217;s name and use this function in a report.</p>
<h3 class="sectionHeading">Step 1</h3>
<p>First we will create a simple report.<span id="more-402"></span></p>
<div id="attachment_403" class="wp-caption alignnone" style="width: 409px"><img class="size-full wp-image-403" title="Average Customer Sales Columns" src="http://img.oracledeveloper.info/2010/01/average_customer_sales_columns.png" alt="Average Customer Sales Columns" width="399" height="75" /><p class="wp-caption-text">Average Customer Sales Columns</p></div>
<h3 class="sectionHeading">Step 2</h3>
<p>When run, the report looks like this.</p>
<div id="attachment_406" class="wp-caption alignnone" style="width: 345px"><img class="size-full wp-image-406 " title="Average Customer Sales Results" src="http://img.oracledeveloper.info/2010/01/average_customer_sales_results.png" alt="Average Customer Sales Results" width="335" height="234" /><p class="wp-caption-text">Average Customer Sales</p></div>
<h3 class="sectionHeading">Step 3</h3>
<p>We&#8217;d like the customer name to appear in our standard corporate name format (&lt;Title&gt; &lt;First Initial&gt;. &lt;LastName&gt;) so we decide to use our standard name formatting function.</p>
<p>e.g. Mrs Maureen Baker would appear as Mrs. M. Baker</p>
<p>This is all well and good, but as this is an example, I don&#8217;t currently have a &#8216;corporation&#8217; let alone a &#8217;standard corporate name format&#8217; or a &#8217;standard name formatting function&#8217;! So I will now create one. I&#8217;m only saying this because this is why you would logically call a user defined function because you have certain ones which are &#8217;standard&#8217; throughout your organisation.</p>
<p>The function we will call I will call &#8216;fullname&#8217; and it will take 5 parameters:</p>
<ol>
<li>first_name</li>
<li>last_name</li>
<li>gender</li>
<li>marital_status</li>
<li>name_format</li>
</ol>
<p>The parameters are all quite obvious except the last one. A name can appear in many different ways. &#8216;name_format&#8217; is a constant which defines which name format we want to use. If a new name format is required then this can easily be added to the function so that it will return this new format.</p>
<p>For those of you that understand PL/SQL, this is the function I will use.</p>
<pre class="plsqlCode">CREATE OR REPLACE
FUNCTION fullname(first_name     IN VARCHAR2 DEFAULT NULL
                 ,last_name      IN VARCHAR2 DEFAULT NULL
                 ,gender         IN VARCHAR2 DEFAULT NULL
                 ,marital_status IN VARCHAR2 DEFAULT NULL
                 ,name_format    IN NUMBER   DEFAULT 1
                 )
RETURN VARCHAR2
IS
/*************************************************************
* Name:        fullname
* Description: Formats a name based on the name_format value.
*              The index number indicates the name_format value.
*              Possible formats for Susan Taylor (F) Married are:
*
*              1. Susan Taylor
*              2. S. Taylor
*              3. Mrs. Susan Taylor
*              4. Mrs. S. Taylor
*              5. S. Taylor (Mrs)
*
* Parameters:  first_name     = First name
*              last_name      = Last name (Surname)
*              gender         = Can take values Male, Female, M, F
*              marital_status = Takes value 'married'.
*                               Any other value assumes is 'not married'
*              name_format    = Number indicating name format (see description)
*                               which want returned
*
* History
*
* Version   Date        Author      Description
* ------------------------------------------------------------
* 001       10-Jan-2010 O. Dev      Original Version
**************************************************************/

    lc_PROCEDURE_NAME   CONSTANT VARCHAR2(30) := 'fullname';

    l_fullname      VARCHAR2(100);
    l_title         VARCHAR2(10);
    l_fullstop      VARCHAR2(1) := '';
    l_initial       VARCHAR2(2);

BEGIN

    CASE (UPPER(SUBSTR(fullname.gender, 1, 1)))

        WHEN 'F' THEN
            IF (UPPER(fullname.marital_status) = 'MARRIED') THEN
                l_title := 'Mrs';
                l_fullstop := '.';
            ELSE
                l_title := 'Miss';
            END IF;           

        WHEN 'M' THEN
            l_title := 'Mr';
            l_fullstop := '.';

        ELSE
            l_title := '';   

    END CASE;

    l_initial := UPPER(SUBSTR(fullname.first_name, 1, 1));

    IF (l_initial IS NOT NULL) THEN
        l_initial := l_initial||'.';
    END IF;

    CASE (fullname.name_format)

        --5. S. Taylor (Mrs)
        WHEN 5 THEN
            l_fullname := TRIM(l_initial||' '||fullname.last_name||' ('||l_title||')');

        --4. Mrs. S. Taylor
        WHEN 4 THEN
            l_fullname := TRIM(l_title||l_fullstop||' '||l_initial||' '||fullname.last_name);

        --3. Mrs. Susan Taylor
        WHEN 3 THEN
            l_fullname := TRIM(l_title||l_fullstop||' '||fullname.first_name||' '||fullname.last_name);

        --2. S. Taylor
        WHEN 2 THEN
            l_fullname := TRIM(l_initial||' '||fullname.last_name);

        --1. Susan Taylor
        ELSE
            l_fullname := TRIM(fullname.first_name||' '||fullname.last_name);

    END CASE;        

    RETURN l_fullname;                                   

END fullname;</pre>
<p>This function needs to be compiled in the SH schema, or if not, the SH schema needs to be granted access to it.</p>
<h3 class="sectionHeading">Step 4</h3>
<p>So, now we have the report we want to write and we have a function we can call that will return a customer name in the format we want. So how do we call the pre-defined function in OBI?</p>
<p>To call a function we need to use the <strong><em>EVALUATE</em> </strong>function.</p>
<p>The syntax of this function is:</p>
<p><em><strong>EVAULATE(&#8217;your db function(%1,%2)&#8217;, parameter list)</strong></em></p>
<p>where,</p>
<ul>
<li>%1 and %2 &#8211; the number of parameters</li>
<li>parameter list &#8211; comma separated list of values we are passing into the function</li>
</ul>
<p>e.g.</p>
<p><em><strong>EVALUATE(&#8217;upper(%1)&#8217;, &#8216;new york&#8217;)</strong></em></p>
<p>gives the result:</p>
<p><strong>NEW YORK</strong></p>
<h3 class="sectionHeading">Step 5</h3>
<p>So we would call our function as follows:</p>
<p><em><strong>EVALUATE(&#8217;fullname(%1,%2,%3,%4,%5)&#8217;, &lt;first name&gt;, &lt;last name&gt;, &lt;gender&gt;, &lt;marital status&gt;, &lt;name format&gt;)</strong></em></p>
<p>e.g.</p>
<p><em><strong>EVALUATE(&#8217;fullname(%1,%2,%3,%4,%5)&#8217;, &#8216;James&#8217;, &#8216;Thompson&#8217;, &#8216;Male&#8217;, &#8216;Single&#8217;, 3)</strong></em></p>
<h3 class="sectionHeading">Step 6</h3>
<p>Add the function to the report. To do this we add a new field to the report, e.g. &#8216;Customer Name&#8217; then &#8216;Edit Formula&#8217; of this field.</p>
<div id="attachment_409" class="wp-caption alignnone" style="width: 570px"><img class="size-full wp-image-409" title="Edit Customer Name Formula" src="http://img.oracledeveloper.info/2010/01/edit_customer_name_formula.png" alt="Edit Customer Name Formula" width="560" height="374" /><p class="wp-caption-text">Edit Customer Name Formula</p></div>
<h3 class="sectionHeading">Step 7</h3>
<p>Replace Customers.&#8221;Customer Name&#8221; with our user defined function.</p>
<div id="attachment_411" class="wp-caption alignnone" style="width: 552px"><img class="size-full wp-image-411" title="Customer User Defined Function" src="http://img.oracledeveloper.info/2010/01/customer_user_defined_function_01.png" alt="Customer User Defined Function" width="542" height="103" /><p class="wp-caption-text">Customer User Defined Function</p></div>
<h3 class="sectionHeading">Step 8</h3>
<p>Click OK and you will get the following error.</p>
<div id="attachment_412" class="wp-caption alignnone" style="width: 469px"><img class="size-full wp-image-412 " title="Customer User Defined Function Error" src="http://img.oracledeveloper.info/2010/01/customer_user_defined_function_error_01.png" alt="Customer User Defined_Function Error" width="459" height="124" /><p class="wp-caption-text">Customer User Defined Function Error</p></div>
<h3 class="sectionHeading">Step 9</h3>
<p>This is caused by the EVALUATE function expecting all the parameters to be strings and the last parameter in our function is actually a NUMBER. Convert the last value to a string and click OK. This will save okay. Oracle will now convert the string to a number when it calls the &#8216;fullname&#8217; function. Bit silly, but it&#8217;s a way around the problem.</p>
<div id="attachment_413" class="wp-caption alignnone" style="width: 469px"><img class="size-full wp-image-413" title="Customer User Defined Function" src="http://img.oracledeveloper.info/2010/01/customer_user_defined_function_02.png" alt="Customer User Defined Function" width="459" height="27" /><p class="wp-caption-text">Customer User Defined Function</p></div>
<h3 class="sectionHeading">Step 10</h3>
<p>Now run the report and you will probably get some unexpected results.</p>
<div id="attachment_415" class="wp-caption alignnone" style="width: 262px"><img class="size-full wp-image-415 " title="Average Customer Sales" src="http://img.oracledeveloper.info/2010/01/average_customer_sales_results_hardcoded.png" alt="Average Customer Sales Results" width="252" height="214" /><p class="wp-caption-text">Average Customer Sales</p></div>
<p>We&#8217;re expecting the customer column to contain &#8216;Mr. J. Thompson&#8217;, instead we get the first 8 characters, &#8216;Mr. J. T&#8217;. This is a strange consequence of using hardcoded values in a function we call using the EVALUATE function. Here it defaults a string to 8 characters and we can&#8217;t change this default! If we were to choose name_format = 1 and make the first name 38 characters long then we would get returned a customer name which is 38 characters long. i.e. it defaults to the length of the first parameter used in the EVALUATE function.</p>
<div id="attachment_416" class="wp-caption alignnone" style="width: 401px"><img class="size-full wp-image-416" title="Average Customer Sales 38 Character Firstname" src="http://img.oracledeveloper.info/2010/01/average_customer_sales_38_char_firstname.png" alt="Average Customer Sales 38 Character Firstname" width="391" height="177" /><p class="wp-caption-text">Average Customer Sales 38 Character Firstname</p></div>
<h3 class="sectionHeading">Step 11</h3>
<p>Fortunately for us (and Oracle) the EVALUATE function works if we pass in column names instead of hardcoded values. But it&#8217;s good to know what can happen if our function does not always use column names!</p>
<p>Change the function to now use four column names and set the fifth parameter to &#8216;4&#8242;.</p>
<div id="attachment_418" class="wp-caption alignnone" style="width: 469px"><img class="size-full wp-image-418" title="Evaluate Function" src="http://img.oracledeveloper.info/2010/01/evaluate_fullname_function.png" alt="Evaluate Function" width="459" height="49" /><p class="wp-caption-text">Evaluate Function</p></div>
<h3 class="sectionHeading">Step 12</h3>
<p>Click on the &#8216;Results&#8217; tab. The report should now look like this.</p>
<div id="attachment_419" class="wp-caption alignnone" style="width: 430px"><img class="size-full wp-image-419 " title="Average Customer Sales" src="http://img.oracledeveloper.info/2010/01/average_customer_sales_results_02.png" alt="Average Customer Sales Results" width="420" height="231" /><p class="wp-caption-text">Average Customer Sales</p></div>
<h3 class="sectionHeading">Step 13</h3>
<p>Now the report is working we can now tidy it up so that it only contains 2 columns. (We have hidden the firstname and lastname columns but still use them to order the report by lastname followed by firstname.)</p>
<div id="attachment_421" class="wp-caption alignnone" style="width: 256px"><img class="size-full wp-image-421 " title="Average Customer Sales" src="http://img.oracledeveloper.info/2010/01/average_customer_sales_results_final.png" alt="Average Customer Sales Results" width="246" height="292" /><p class="wp-caption-text">Average Customer Sales</p></div>
<h3 class="sectionHeading">Step 14</h3>
<p>If we do not like the customer name format it only takes a moment to change the name_format parameter and use a new format, e.g. name_format = 5.</p>
<div id="attachment_423" class="wp-caption alignnone" style="width: 257px"><img class="size-full wp-image-423" title="Average Customer Sales" src="http://img.oracledeveloper.info/2010/01/average_customer_sales_results_final_02.png" alt="Average Customer Sales" width="247" height="289" /><p class="wp-caption-text">Average Customer Sales</p></div>
<h3 class="sectionHeading">Footnote</h3>
<p>You can see how easy it is to create and use a user defined function. However, this may not necessarily be the best way to write an OBI Answers report. The reason being that the function being called will have to be processed for every record in the report. This may be extremely costly in processing time. It may be better to use this function during the development phase of the datawarehouse so that the data is easily available in OBI Answers.</p>
<p>A good time to use a user defined function is during development. A developer can produce a function and test it in an OBI Answers report. An end user can also use it. If the function is useful it can then be added as part of the ETL processes during the update of the data warehouse.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oracledeveloper.info/obi-answers-user-defined-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OBISE1 and OBIEE Tutorials</title>
		<link>http://www.oracledeveloper.info/obise1-and-obiee-tutorials/</link>
		<comments>http://www.oracledeveloper.info/obise1-and-obiee-tutorials/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 10:19:33 +0000</pubDate>
		<dc:creator>Oracle Developer</dc:creator>
				<category><![CDATA[OBI Answers]]></category>
		<category><![CDATA[Oracle Business Intelligence]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.oracledeveloper.info/?p=277</guid>
		<description><![CDATA[There are a lot of good tutorials out there on Oracle Business Intelligence (formerly Siebel Analytics) Standard Edition (OBISE1) and Enterprise Edition (OBIEE). So, I really do not want to reinvent the wheel. What I have found is that it is the simple things that can sometimes be confusing. The sort of things that a [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of good tutorials out there on Oracle Business Intelligence (formerly Siebel Analytics) Standard Edition (OBISE1) and Enterprise Edition (OBIEE). So, I really do not want to reinvent the wheel. What I have found is that it is the simple things that can sometimes be confusing. The sort of things that a detailed tutorial will assume you know, or ones that you do know, it&#8217;s just slipped your mind.<br />
<span id="more-277"></span></p>
<p>My plan is to present a whole range of very simple &#8216;How do you do this?&#8217; tutorials that maybe take a few minutes to complete and solve a single very basic step.</p>
<p>For the vast majority of people they are probably too simple. For people who are starting out though I hope they offer a very useful step in your development.</p>
<p>I&#8217;m perceiving that there may end up a lot of short tutorials which will take me sometime to complete. I will methodically go through the different areas of OBI to produce these tutorials. If you think I should give priority to some parts more than others, please let me know. If I miss anything out, also let me know. Hopefully over the next few months I will have created a useful reference guide to OBI users and developers everywhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oracledeveloper.info/obise1-and-obiee-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
