Showing posts with label Metadata. Show all posts
Showing posts with label Metadata. Show all posts

Retrieving non-existent data for a global view of reality

When reviewing sales data, sometimes there is a need to show not only the data that exists, but also the data that does not exist. For instance, in the tables below we can see that no revenue was generated in the month of April and also that no revenue was generated from customer JKL between January and June.
chart 1
chart 2

Imagine that you have the following star schema: the classic time dimension with all the dates, another dimension with all the products that your company sells, and a fact table containing the sales transactions with its associated revenue.
Star Schema
The challenge is to build a report showing the revenue for each product and date during a given period of time. This report must also show days without sales and also the products that did not sell during this period.
Unfortunately, a query based on the above star schema is going to retrieve data only for the combinations of products and dates when sales were achieved. This is illustrated in the following table:
Chart 3
This article will show you how to retrieve the missing data to gain a global view of reality...
We will start with a report showing the revenue by product and date in the period between January 1 and January 15, 2001:
Figure 1: Sales from 01/01/2001 to 15/01/2001
Figure 1: Sales from 01/01/2001 to 15/01/2001
Despite this being valuable information, the requirement is to show this information for all days and all products. Fortunately, Oracle Business Intelligence gives us the tools to retrieve this missing data. Let’s see how...
In order to accomplish our objective we have to create a new physical fact table. This table will contain a dummy column with non meaningful data but it is important that it is a numeric data. The purpose of this fact table is to allow us to do a drill across different fact tables (the original one, containing the transactional data; and the new one, containing the Cartesian product of the involved dimensions).
Figure 2: Creating a new fact table with dummy values
Figure 2: Creating a new fact table with dummy values
Figure 3: Creating the dummy column
Figure 3: Creating the dummy column
Now we need to create an alias for the table and make complex joins between the dimensions and the fact table, as shown below:
Figure 4: Physical join
Figure 4: Physical join
Note that the “1=1” join enables a Cartesian product between all the dimensions that will join to this fact table.
Figure 5: Physical diagram
Figure 5: Physical diagram
After the physical star has been modelled, we need to create a new logical fact table in the Business Model & Mapping layer based on the new physical fact table. The aggregation rule for the dummy column needs to be set (don’t leave it as ‘None’).
Figure 6
Figure 6
Figure 7: Setting aggregation rule for the dummy column
Figure 7: Setting aggregation rule for the dummy column
Next we need to create the complex joins between the dimensions and the fact table:
Figure 8: Business Model Layer Diagram
Figure 8: Business Model Layer Diagram
Finally we need to add the new fact table to the presentation layer.
Now we are ready to build our report again. This time we add the dummy column together with the other columns used before. We hide the dummy column and we obtain the new report. As shown below, we get data for all selected days (Figure 9).
Figure 9: Sales from 01/01/2001 to 15/01/2001
Figure 9: Sales from 01/01/2001 to 15/01/2001
As shown in Figure 10, we see that all products are in the table even if they have not been sold during the selected time period.
Figure 10: Observe how the products without any sales still appear in the table
Figure 10: Observe how the products without any sales still appear in the table
The new physical fact table with a dummy column has allowed us to show all dates and all products in our report for a full view of reality and better business insight!
If you have any questions or comments about this tip, please feel free to leave a comment below.

OBIEE – Localisation – Externalize Metadata Strings

There are couple of benefits working across different projects and give the consulatncy all way around to gather ad-hoc knowledge and get to learn new features , explore it and establish the idea . Pretty Cool huh !  :)
One of the foremost important feature in OBIEE is  Localisation i.e Multi country implementation .It’s a robust feature indeed ! to make the application reusable across several country in multi country roll-out deployment and thus Internationalizing the application .
The Oracle Business Intelligence Presentation layer supports multiple language translations for any presentation column name and column description. When working with Oracle BI Answers or rendering a dashboard, users should see their local language strings in their reports. For example, English-speaking and French-speaking users would see their local language strings in their reports. There are two kinds of application strings required for the translation in Oracle Business Intelligence :
Metadata Strings
Metadata strings are Analytics-created objects in the Oracle Business Intelligence repository objects such as Subject Area, Metrics, Dimensions etc. Read Oracle Ref .
Presentation Services (Localizing Presentation Catalog Captions)
Presentation Services objects are end-user created objects such as Reports, Dashboards, and Pages. Translations for Presentation Services strings are stored in the captions.xml file.How this could be accessed can be found from Oracle BI Presentation Service Admin Guide .
So there are 2 aspects of this localisation . One from RPD perspective and other from BI Catalog perspective .
In RPD perspective changes user can visualize the change in column name and description due to localisation . However in Catalog perspective change, user can see the localised country specific language translated string for Reports / Dashboards / Pages .
So lets prepare a sample data bed and then configure both first in Repository area(Externalizing Metadata Strings) and then from Catalog (Web Catalog Strings) .
The sample data I have created as below :
Localisation1Localisation2
Localisation3
Now I have imported those tables and done and simple RPD configuration .Note that there are a table ‘W_MSG’ will be used to store  metadata translation string and will be described later .
Localisation4
Localisation5
Lets externalize both Name and Descriptions in RPD and then export that string into a CSV file .
Localisation7
Localisation8
I have exported the CSV to a file called “Sample_Sales_Externalised_Strng.csv” .Lets see it :
Localisation10
Now lets modify the csv with the translated strings ( taking reference of Google Translator) with different languages and perform the loading from csv into Language Translation table called “W_MSG” as mentioned earlier .
After loading the table looks like :
Localisation11
So for same MSG_NUM value there will be different MSG_TEXT for each individual language .MSG_NUM represents session variable of the metadata string , MSG_TEXT represents the translation for the metadata string and LANG_ID represents the language of translation.
N.B :- Make sure that none of the MSG_TEXT will be NULL otherwise loading of the Metadata Strings will simply return void while logging in using different Web Languages other than English .I have encounter this problem and it seems to be a Bug in 10.1.3.4 as there are no documented product bug fix available either .
Now the above metadata strings will be loaded by the BI Server from the database table .Lets see how this will be loaded from the repository configuration .Create the below Session Init Block and assign the target variable as shown below :
Localisation12
Localisation13Localisation14
LOCALE and External Metadata Strings are the initialization blocks which are need to be created for the localization of the metadata strings. N.B :- In first snapshot LOCALE system session variable has been assigned with the value of the Weblanguages using below :
select ‘VALUEOF(NQ_SESSION.WEBLANGUAGE)’ from DUAL
Hence the value of this would be populated as ‘de’ (while you logging in OBIEE after switching  the language as Deutsh) , ‘en’ (while you logging in OBIEE after switching the language as English) etc .
Now in second snapshot the entire W_MSG table will be scanned through and the rows will be returned by Row-wise Initialisation Block and set the execution precedence as LOCALE as this variable has been used in below block :
select MSG_NUM, MSG_TEXT
from W_MSG
where LANG_ID = decode( ‘VALUEOF(NQ_SESSION.LOCALE)’ ,
‘en’ , ‘ENU’,
‘fr’, ‘FRA’,
‘de’ , ‘DEU’,
‘es’, ‘ESN’,
‘ja’, ‘JPN’,
‘pt-br’, ‘PTB’,
‘it’, ‘ITA’,
‘sv’, ‘SVE’,
‘da’, ‘DAN’,
‘nl’, ‘NLD’,
‘zh’ , ‘CHS’,
‘zh-tw’, ‘CHT’,
‘iw’, ‘HEB’,
‘ko’, ‘KOR’,
‘cs’, ‘CSY’,
‘fi’ , ‘FIN’,
‘el’, ‘ELL’,
‘pt’, ‘PTG’,
‘pl’, ‘POL’,
‘el’,'GRC’,
‘hu’,'HUN’,
‘ro’,'ROM’,
‘sk’,'SKY’,
‘fr-ca’,'FRC’,
‘en-ca’,'ENC’,
‘en-gb’,'ENG’,
‘en-nl’,'ENN’,
‘en-ie’,'ENI’,
‘fr-ch’,'FRS’,
‘de-ch’,'DES’,
‘de-at’,'DEA’,
‘fr-be’,'FRB’,
‘nl-be’,'NLB’,
‘tr’,'TRK’,
‘ENU’)
The above block will decode the language say for e.g : ‘de’ to ‘DEU’ and query through the translation table to search the session variables ‘MSG_TEXT’ .
Now simply log-in after setting language ‘English’  you will get the metadata string descriptions in tooltip as below :
Localisation15
Log out and log-in after setting language ‘Deutsch”  .
Localisation16
You will get the translated name for Presentation column and translated metadata description in tooltip as below :
Localisation18
Now you can see the Catalog description for the subject area has been translated as well in language ‘German’ .
Localisation17
Same in language ‘French’  as well .
Localisation19
This is how the localisation has been done in Repository perspective . However there will be some more area in catalog need to have the translated strings like ‘Dashboard Name’ , ‘ Page Name’ , ‘ Narratives’ , ‘HTML’ , ‘Link Caption’ which need to be done from the XML change in catalog extract .
See you next time in this thread continuing the part of Catalog translation .    to be continued …..
So … here I am right back to explain how of  Localizing Presentation Catalog Captions can be done . This is a very important part to understand as localised country will definitely not only will be interested for the Metadata translation ..rather they like to see the translated strings for Dashboard , Pages , Links , Narratives etc. all .
To understand in details how this could be done … refer to Oracle documentation . Lets follow the below steps :
1) Open the Catalog Manager . Shutdown all BI services .
2) Open the Catalog using the catalog manager offline .
3) Select the catalog folder which we would be interested for Translation .In my case I have exported the Shared folder .So all its subfolders have been exported .
4) Save the files under some location and copy Salescaptions.xml to
“..\OracleBIDataHome\web\msgdb\l_de\Captions” .
However oracle documentation talks about the export into different location i.e “SADATADIR\web\res\l_xx\Captions” which is a proven bug and explained under “2.2.8 Issue Handling Captions in Presentation Services” topic of  :
Oracle® Business Intelligence Suite Enterprise
Edition
Release Notes
Version 10.1.3.4
Part No. E10404-17

N.B : – Since I would like to see the translation in language German .Hence place the Captions file under “l_de”  where de=Deutsch . Similarly for French it would be under “l_fr” .
Localisation20Localisation21
Localisation22
Now since I have created a mapping document for all the catalog strings like below and according to that I have modified my Captions XML file .
————————————————————————————-
Localisation23
Localisation24
After modifying the XML as above note that you have to ensure that , there  should not be any XML error thrown by running the XML file directly in your browser i.e we have to avoid error shown as below(if any) :
Localisation25As error like this will cause the translation failure and the entire translation will be go into hell . Be cautious about the characters like ‘&’ ,’ ä ‘,’ ü ‘ . In my case I avoid this characters from German strings and simply use ‘a’ ,’u’ etc .I am not German expert and don’t know how to avoid this or make this character supportable in my XML :( Anybody could help !
4) Restart the BI presentation Services and Log in by setting language Deutsch and see the translation .
Localisation26
Strange enough with  the Red marked links . Rest of them has been translated good …. ! Its true that I have editing all possible strings in my XML file but I have not find the strings for Page translation ,Links etc . So that could possibly in some different files . Yes , Got it !
Perform the Export Captions by selecting the root ‘/’ and you will get 3 captions again :
userscaptions.xml  – This is the culprit . Translation in this area would reflect into page and links .
systemcaptions.xml — Not bothers about .
sharedcaptions.xml — This is a superset of Salescaptions.xml here and typically the superset if more than one catalog under the same “/” i.e root folder .
So  modified the userscaptions.xml file and restart the presentation services . N.B : - sharedcaptions.xml should not be there inside “l_de” folder as this will overrride the Salescaptions.xml translation strings .
Localisation27
Logging in once again in Deutsch and Voila … all the problems resolved … So Happy Localising   :) :) :)
Localisation28Localisation29

OBIEE Metadata Dictionary Features

One of the new feature introduced in OBIEE 10.1.3.3 is Metadata Dictionary whichc is a handy web based information to map the answers objects across business layers to Physical layers . The information extracted from below link as “this Metadata Dictionary can now be accessed directly from the Oracle BI Answers selection pane where specific metadata information will be shown to guide report construction. Once this Oracle BI Answers-based functionality has been enabled as described in this section, an icon will appear next to each Subject Area, Table name, and Column shown in the selection pane for that Subject Area. The Subject Area icon is always displayed, whereas the Table name and Column name icons are only displayed on mouse-over. Clicking on the icon will open up a specific Metadata Dictionary page to show information for that element and links to related repository information” .
BI metadata repository is available through the Metadata Dictionary (a set of XML documents), which contains information across the entire BI metadata repository, ie from the presentation layer , through the business model (including dimensions, their levels and hierarchies, and join their types, calculations and used expressions, aggregation rules and functions, etc.) to the physical layer (including the names of the physical tables and columns of data types, all the links, the type of database, supported db properties, setting Connection Pool, etc.). In addition, there are all the initialization blocks, variable system, user groups and their privileges…
Metadata Dictionary is available from version of OBI 10.1.3.3 onwards:To configure this functionality, a Metadata Dictionary should first be generated using the Oracle BI Administration Tool, as follows:
1. On the machine where Oracle BI is installed, launch the Oracle BI Administration Tool.
2. Log in to the desired repository in “Offline” mode.
3. Create the dictionary using: Tools -> Utilities -> Generate Metadata Dictionary.
You can save the metadata anywhere in your directory and then move to particular destination .For my case the the rpd name is test.rpd and metadata directories have been  created as below under ..\test .
For IIS WebServer
Move the test dir to “D:\OracleBIData\web\res\dictionary”  location
So finally you have :
Metadata Dict
 Now create a entry in your instanceconfig.xml under tag <ServerInstance> to include below :
<SubjectAreaMetadata>
<DictionaryURLPrefix>/analyticsres/dictionary/</DictionaryURLPrefix>
</SubjectAreaMetadata>
For OC4J Container
Move the test dir to “D:\OracleBI\oc4j_bi\j2ee\home\default-web-app\dictionary” location .
So finally you have :
Metadata Dict2
Now create a entry in your instanceconfig.xml under tag <ServerInstance> to include below :
<SubjectAreaMetadata>
<DictionaryURLPrefix>/dictionary/</DictionaryURLPrefix>
</SubjectAreaMetadata>
So the instanceconfig.xml looks like as below :
Metadata Dict3
Restart Oracle BI Presentation Server
Start BI Answers, select a target area, and then for each component, the item or the whole area will be available in a preview of Metadata Dictionary (book icon – for components and items will appear after the mouse cursor hovering to it).
Metadata Dict4
The right to inspect Metadata Dictionary may not have any user. Authorization shall be governed by the presentation services – in the BI Dashboadu enable access to metadata dictionary to selected users (BI Dashboards> Settings> Administration> Administration approval> Access).
Clicking on Subject Area SCOTT redirect to below :
Metadata Dict5
Click on the presentation object to navigate across the tree like metadata objects .