Sunday, March 29, 2015

OBIEE - Selecting columns dynamically - part4, working with and selecting none

In this part I will talk about how to remove column from analysis with column selector or prompt. That means, selecting a column I don't want to present (or actually influence the analysis at all). Why do I want such a stupid thing? When working with dynamic columns, I want the ability to control the number of columns. So if the user wants only 3 columns, out of possible 5, only 3 columns would appear in the analysis. The other 2 columns will not show.

How do I add such "None" column?
I will describe 2 options. First is created at the User Interface level, the second in RPD only and works better with session variables. Usually the second should be your default option and it is the one to be used in the next post.

Solution 1 

I add a column in the repository with empty value and default this column to be hidden, system wide. Now I can use the column anywhere I want. Lets have a detailed explanation.

I'm working with the extended sample available as part of the VM here. So I'm working with real Oracle DB tables in this case. (The following doesn't work well with the XML files of the default Sample).
In the Business layer I randomly selected the Time dimension and added a column with '' value. I named it None.

As a next step I created a new Presentation Table under the Sample Sales and named the table None, then dragged the none column under it.
Now I have the None column. OBIEE enables me to create analysis with this column:

What is nice here, is the fact that the SQL doesn't join unnecessary tables:
This is the left one (only the fact table in the original From):
 
WITH 
SAWITH0 AS (select sum(T42433.Revenue) as c1,
     '' as c2
from 
     BISAMPLE.SAMP_REVENUE_F T42433 /* F10 Billed Rev */ ),
SAWITH1 AS (select D1.c1 as c1,
     D1.c2 as c2,
     D1.c3 as c3
from 
     (select 0 as c1,
               D1.c2 as c2,
               D1.c1 as c3,
               ROW_NUMBER() OVER (PARTITION BY D1.c2 ORDER BY D1.c2 ASC) as c4
          from 
               SAWITH0 D1
     ) D1
where  ( D1.c4 = 1 ) )
select D1.c1 as c1, D1.c2 as c2, D1.c3 as c3 from ( select D1.c1 as c1,
     D1.c2 as c2,
     D1.c3 as c3
from 
     SAWITH1 D1
order by c1, c2 ) D1 

In a similar way, the right one is correct as well, with no unnecessary joins to date dimension.
 SAWITH0 AS (select sum(T42433.Units) as c1,
     T42412.Department as c2,
     '' as c3,
     T42412.Dept_Key as c4
from
     BISAMPLE.SAMP_OFFICES_D T42412 /* D30 Offices */ ,
     BISAMPLE.SAMP_REVENUE_F T42433 /* F10 Billed Rev */

where  ( T42412.Office_Key = T42433.Office_Key )
group by T42412.Department, T42412.Dept_Key)...


Next step, as administrator I will create an Analysis with the None column and select it's Column Properties.


In Column Format I'll select "Hide".


And at the bottom of that screen I will select Save As default / Save as system-wide default for "None"."None": 

the same with Zoom-In:

That's all. Now I can use the None column in any other analysis as Column Selector, described in the first post, or as Presentation variable, described in second and third.

For example the same analysis with Column selector, selecting once the None column and then some other column:

When None is in the column of Column selector:
When Per Name Year is in the column of Column selector:



Solution 2

Just as in solution 1, I add a column in the repository with empty value and default this column to be hidden, system wide. Now I can use the column anywhere I want. I'll name it None1. The process of creating this table is the same as in Solution 1, with the formula '':
 
With one critical difference, the hiding will be done at the repository (presentation level) and not UI, as solutions 1.
At the presentation level I will go to the None properties and set the "Hide object if "condition to 1=1. This way the column is always hidden.

Now when going to Analysis we don't see the column None1:
But it doesn't mean it's not there; You just have to know it's name.
For example an analysis with Revenue and the new None1 column:
 Results:

(Thank You Dov Ziskin, from VisionBI for reminding me the second solution). 


Now we are ready to do some real Dynamic Columns example, in the next post.


Solution 3

 This solution is similar to solution 2, but you can hide the None 1 column by preventing access to it in the permissions.



Just remember to change the parameter PROJECT_INACCESSIBLE_COLUMN_AS_NULL  in nqsconfig.ini to Yes, or you will get an Error.




P.S.


Never test the above with administration user like weblogic. Unless you want to spend hours testing it and questioning the idiot who wrote the above.
User weblogic can see everything, including the hidden columns.

16 comments:

  1. Thank you for posting sales force online training. with best regards:
    Sales force online training

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete

  5. Spot on with this write-up, I absolutely believe this web site needs a lot more attention. I’ll probably be back again to read through more, thanks for the information!
    SAP APO Online Training

    ReplyDelete
  6. Hi,
    I have created "None"."None" in RPD as per example provided in solution 2 and I have set columns formula as below:

    case when 1=1 then "None"."None" else 'Iamhere' end

    As per above example this column should hide but in my case no luck. I have to select multiple columns dynamically and display value of those columns. Could you please help me out with this? Thanks in advance.

    Thanks
    Alex

    ReplyDelete
    Replies
    1. Alex,use solution 2 above, when the column none is always hidden. Then you don't need such case statements.

      Delete
  7. Solution 2 doesn't seem work for me either. I use obiee 11.1.1.9. The None column is hidden on the SA as a column, but when put it on a report, the column always shows... Is there any configuration regarding this???

    ReplyDelete
    Replies
    1. Are you Weblogic user or any other type of bi-administrator?

      Delete
  8. Solution 2 does not seem working in OBIEE 111.1.9 for me as well. i tried both administrator and non administrator user.

    ReplyDelete
  9. This post is much helpful for us. This is really very massive value to all the readers and it will be the only reason for the post to get popular with great authority. Selenium Training in Chennai | Selenium Training institutes in Chennai

    ReplyDelete
  10. Solution 1 and Solution 2 not working for me as well.
    It always shows up int report .Hidden column shows values.
    Any help ?

    ReplyDelete