Showing posts with label column. Show all posts
Showing posts with label column. Show all posts

Wednesday, 24 August 2011

OBIEE – Dimension fragmentation design to add an automatic filter with the choice of a column


In response to an original Idea of Venkat with this blog entry: [[http://www.rittmanmead.com/2010/02/13/oracle-bi-ee-10-1-3-4-1-puzzlers-puzzle-1/|Puzzlers – Puzzle 1]]


“How do we make BI EE to generate different filters for every column(within a dimension) chosen from Answers?”


The idea is when you add the column Channel desc to an answer the query must be automatically filtered.


You can also found a copy of this entry in the wiki : [[http://gerardnico.com/wiki/dat/obiee/dimension_fragmentation_filter|OBIEE - Dimension fragmentation design to add an automatic filter with the choice of a column]]



An other simple solution to achieve this goal is to use the security filter:
[[dat:obiee:bi_server:security:security_automatic_filter_on_column]]



After a good night of rust, I deleted the alias of the physical table Channels because this solution creates a self join on the table channels. You can see the old solution [[dat:obiee:dimension_fragmentation_filter#the_old_solution|here]]


===== The design =====
*- Suppress the old logical column “Channel Desc”, create a new one with the same name
* 1 – Create a new logical table source “CHANNELS_FILTER” in the logical table Channels
* 2- Map the new logical column Channel Desc to the physical Column Channels.”Channel Desc” in the tab “Column Mapping”
* 3- Add the filter in the content tab
* – Drag and drop the new logical column in the presentation layer


{{:dat:obiee:repository_design_filter_on_column_new_logical_table.jpg|}}


===== The result =====


==== With the column “Channel class” and “Amount Sold” ====
**Sql Request**


SELECT Channels.”Channel Class” saw_0, “Sales Facts”.”Amount Sold” saw_1 FROM SH ORDER BY saw_0


{{:dat:obiee:repository_design_filter_on_column_result1.jpg|}}


As you can see no filter is added to the database query.


**Database Query**


select T161.CHANNEL_CLASS as c1,
sum(T245.AMOUNT_SOLD) as c2
from
SH.CHANNELS T161,
SH.SALES T245
where ( T161.CHANNEL_ID = T245.CHANNEL_ID )
group by T161.CHANNEL_CLASS
order by c1


==== With the column “Channel desc” and “Amount Sold” ====
**Sql Request**


SELECT Channels.”Channel Class” saw_0, Channels.”Channel Desc” saw_1, “Sales Facts”.”Amount Sold” saw_2 FROM SH ORDER BY saw_0, saw_1


By adding the column Channels.”Channel Desc”, OBIEE add automatically a filter and the join between the original table channel and its alias


{{:dat:obiee:repository_design_filter_on_column_result2.jpg|}}


**Database Query**


select T161.CHANNEL_CLASS as c1,
T161.CHANNEL_DESC as c2,
sum(T245.AMOUNT_SOLD) as c3
from
SH.CHANNELS T161,
SH.SALES T245
where ( T161.CHANNEL_ID = T245.CHANNEL_ID and T161.CHANNEL_CLASS = ‘Direct’ )
group by T161.CHANNEL_DESC, T161.CHANNEL_CLASS
order by c1, c2


==== With the column “Channel desc” and “Channel class” ====
**Sql Request**


SELECT Channels.”Channel Class” saw_0, Channels.”Channel Desc” saw_1 FROM SH ORDER BY saw_0, saw_1


**Database Query**


select distinct T161.CHANNEL_CLASS as c1,
T161.CHANNEL_DESC as c2
from
SH.CHANNELS T161
where ( T161.CHANNEL_CLASS = ‘Direct’ )
order by c1, c2


 


View the original article here

Obiee – How to mix string and number data type in one column and get a sum ?

Sometimes, you want to mix number and string data type in one column because you want to send a conditional message :


For instance, :
* if value > 1000, write “To Big” else value
* if value is null, write “No Data” else value


If you write a function, on this way as :


CASE WHEN Measures.”Count Passed” IS NULL THEN ‘No Data’ ELSE Measures.”Count Passed” END


You will have this error :


[nQSError: 10058] A general error has occurred. [nQSError: 22027] Union of non-compatible types. (HY000)
SQL Issued: SELECT “Business Rule”.”Rule Name”, CASE WHEN Measures.”Count Passed” IS NULL THEN ‘No Data’
ELSE Measures.”Count Passed” END, Measures.”Count Passed” FROM “MDM Vendor”
nQSError: 10058 A general error has occurred. nQSError: 22027 Union of non-compatible types. (HY000)


If you have already used a software as crystal report, you can’t mix of course two types of data in one field but you can have two fields one above the other. It’s why I have done in [[dat:obiee:presentation_service:obiee_character_number_in_one_column|this solution]].


But with [[language/css/start|css]], we can go further and have a single column.


How ?
* using the content property of [[language/css/start|css]]
* using the conditional formatting of OBIEE


===== The Content property of Css =====


The [[http://www.w3.org/TR/CSS21/generate.html#content|content]] property allow us to format an HTML element by adding an additional content (string, image, …) to a HTML element.


This property can not be use in an inline style such as :


This is a paragraph with the color blue



because it need a [[http://www.w3.org/TR/CSS21/generate.html#before-after-content|:before or :after pseudo-elements]].


We will therefore add two class in the OBIEE stylesheet.


===== How to add a custom class to the OBIEE Style Sheet =====


First, we will open the file custom.css and add this two class to demonstrate this capabilities.


/* This file is intentionally empty. Styles can be defined in a customized */
/* version of this file placed in the SiebelAnalyticsData/Web/Res folder; */
/* and can then be referenced from the “Custom CSS Style Options” area */
/* within some Siebel Answers Formatting Dialogs. These styles will only */
/* affect HTML content. */


td.ClassIsNull:before { content: “This value is null” }
td.ClassIsGreater:before { content: “This value is greater then zero : ” }


The custom.css file is located in a standard installation in the repertory :
Oracle_BiHomeoc4j_bij2eehomeapplicationsanalyticsanalyticsanalyticsRess_NewFrontiersb_mozilla_4


You can check its location with a right click on a OBIEE dashboardpage, select show source code and search “custom.css”.


In my dashboard, you can see below that the custom.css is located here :
* OBIEEAnalyticsWebSiteRoot/analyticsRes/s_NewFrontiers/b_mozilla_4/custom.css


===== Add a conditional formatting =====


Now that the worst is done, you can add a conditional formatting to the column in its property :


{{:dat:obiee:presentation_service:obiee_conditionnal_formating_class.jpg|}}


===== The Result =====


{{:dat:obiee:presentation_service:obiee_table_mix_number_string_sum.jpg|}}


This solution has one limitation, it works of course only in HTML.


 


View the original article here