Changing the Report Columns Dynamically

USING INDEXCOL FUNCTION OBIEE

Business Scenario: You are creating the following report (all columns point to presentation layer columns),

GEOGRAPHY SALES

you need to specify which column in the BM/Physical layer should be used for the query in the place of GEOGRAPHY Presentation column (CEO’s can see region level data. Manager’s can see country level data etc), based on a user login.

----------------

This can be done by using a simple function called as INDEXCOL. Lets look at the INDEXCOL function which forms the basis of what we are trying to do. Syntax of this function is

SYNTAX: IndexCol (integer literal, expr1, expr2, …)

WhereInteger Literal can take integral values like 0, 1, 2 etc and expr can have different BM Columns.
What this function basically does is, it dynamically chooses different columns based on the Integer Literal value. Let’s consider the example below

INDEXCOL( VALUEOF(NQ_SESSION.”LEVEL”), BISE1_TUTORIALWH.GEOGRAPHY.REGION_NAME, BISE1_TUTORIALWH.GEOGRAPHY.COUNTRY_NAME)

In the above function, the INDEXCOL function looks for the LEVEL session variable. If the value of this variable is 0, it will choose the REGION_NAME column. If the value is 1 then it will choose the COUNTRY_NAME column

This Integer Literal can be populated using the Session Variables which fetches value from the database table depending on the user logged on and the expressions can be the different columns from the BM layer which we need to dynamically display as per the Integer Literal.

Popular posts from this blog

How To Unlock Bootloaders on your Xperia Arc S

Inherited Colour Vision Deficiency