Tuesday, 12 June 2012

Random Number Report

While browsing, found a good SQL query for having the random numbers generated.

Acutally this can be useful in the case where we can show a result depending on the value generated.

And YES, even the developer wont be sure of the value generated. Can be well used in GAME type of reports in OBIEE or to tell a fortune message to the user when he/ she logs into the application.

The code can we used in the RPD and can be used in the Answers.
I am using a session variable with the below code in the init block
select to_number(substr(to_char(dbms_random.value), 2, 1)) from dual

I will call this session variable into the column formula of a report and mention the conditions as

case VALUEOF(NQ_SESSION.Random_Ses)
when 2 then 'Bad fortune'
when  3 then 'You would have a Great Day'
when 4 then 'You will meet your luck today'
when 5 then 'You will have a bad day'
when 6 then 'Dont expect'
when 7 then 'Bad Day'
when 8 then 'You will work hard'
when 9 then 'You will go outside'
else 'Nothing Special'
end

Whenever the user logs into the application then the random number is generated and gets a values assigned. And in return he/ she will see the message of their fortune. :)


After the user log in.


Maybe this is also a good example for session variable.

Monday, 11 June 2012

INDEXCOL in OBIEE

Indexcol is an important concept when we use in OBIEE.

You can use the INDEXCOL(constant<Variable>,exp1,exp2,exp3,...)

This can be used in the case of security log in.

For example when the user is of Higher level then he/ she will be able to see the exp1 and the hierarchy wise the user see the expressions.
This really works for the hierarchy columns too.

An example would be-

INDEXCOL(sess_var,col1,col2,col3,col4)

Here-
sess_var       variable value when the user logs in. It gets captured. For ex- Either 1,2,3 or 4
col1,...          Depending upon the sess_var value the columns would be visible to the user.

Friday, 8 June 2012

Sub-Row Below Row in Narrative View

Supposing you need to display the row below the one above in a sub-folder structure.

I am taking two columns
Supposing you are display 1st column and 2nd column
Female
   F 
Male
   M
then try the below in the narrative view-
In Narrative section-
@1 <BR>&nbsp;&nbsp;&nbsp;-->@2
and Row separator section-
<BR>



Result came as-
Female
   -->F
Male
   -->M