Wednesday, 14 May 2014

OBIEE11g: How to create Prompts or Presentation Variables when using "DIRECT DATABASE REQUEST"


Scenario:

We need to create a report using the Direct Database Request and also have to create a prompt to dynamically enter the values by the users. We all know that Direct Database Request is nothing but writing the query which hits the database directly through the RPD Connection Pool. This post explains you how to create the prompts in the database query itself. Though it is almost similar to creating a prompt on the database query minor tweaking has to be done to append this to Obiee.



1)    Create one Dashborad prompt with presentation variable as shown in the below screenshot and assign a default value in this presentation variable.

then Click on Ok

Save the Prompt with the desired name.


2)    Click on New--->Select Analysis---> click on Create Direct data base request as shown in the below screenshot



Give the Connection pool name (It should match with the connection pool name in the RPD and no two connection pools should have the same name) and SQL statement as per requirement.
In the SQL query statement  pass the presentation variable name information as follows.


Query:
 select products.prod_id  ,products.prod_category , products.prod_name ,    sum(amount_sold) from products, sales  where products.prod_id=sales.prod_id and products.PROD_ID IN( @{VAR}{'13'}) group by products.prod_id  ,products.prod_category , products.prod_name

 3)    Now Create one Dashboard and place the report and Dashboard prompt on the  dashboard


4)    Now select the values from the prompt,click on apply and see the values on the report are changing as per the selected prompt values.


18 comments:

  1. Exactly what I was looking for..
    What if you don't want to default to a specified value but want all the values to initially appear?

    ReplyDelete
    Replies
    1. Hi Amy,

      Please take a look at this post and see if it helps. I am sure that there is a way to display all the values by default. I will create a new post for this requirement soon.

      http://obiee11gtips.blogspot.com/2015/10/how-to-work-with-multiple-value-select.html

      Thanks,
      Nagarjuna

      Delete
    2. Hi Amy,

      Try this syntax given in the query. Its working fine. I have created the presentation variable (Brand), when no value is selected in the prompt then the reports renders all the values, if any value is selected in the prompt then the report will get only the selected value results.

      Select * from SAMP_PRODUCTS_D where brand IN (@{Brand.isAllColumnValues?NULL:Brand}['@']{"SAMP_PRODUCTS_D"."BRAND"})

      Thanks,
      Nagarjuna

      Delete
  2. Hi Venkata

    What if I want to prompt for date value, for example. If I want to use the between on two dates using a calender operator. how do I go about doing that?

    ReplyDelete
    Replies
    1. Try the syntax of Date or Datetime as per your requirement. It should work.

      Date Time column:


      Select T1.C1 from SA where T1.DateTimeColumn in (@{myDateTimeVar}{timestamp '2000-01-21 00:00:00'})

      Date-Only column:

      Select T1.C1 from SA where T1.DateColumn in (@{myDateVar}{date '2000-01-21'})

      Delete
  3. If I am only using OBIEE for Direct Database Request and have no tables for creating dashboard prompts, can I use SQL for the Prompt as well? Please advise.

    ReplyDelete
    Replies
    1. Yes, you can use the sql for prompt as well but in your case creating the presentation variable would be mandatory as you are creating the prompt from OBIEE with out using tables from database.

      Thanks,
      Nagarjuna

      Delete
  4. Hi Venkata,

    Yours tips and trics are really helpful for me while my work on obiee.

    Need a help from you. I want to select all column choice values from one prompt and assign those values to another one.

    right now when i select all column (without all column values) its working, but as i select all column values its not.

    please help

    ReplyDelete
    Replies
    1. little modification..

      right now when i select all values (without all column values) its working, but as i select all column values its not.

      Delete
    2. Hi Rahul,

      Check the below sql it should work for all column values.

      Select * from SAMP_PRODUCTS_D where brand IN (@{Brand.isAllColumnValues?NULL:Brand}['@']{"SAMP_PRODUCTS_D"."BRAND"})

      Thanks,
      Nagarjuna

      Delete
  5. Hi Venkata, having issue with following Prompt in OBIEE 11G version 11.1.1.9.160419, AND TRUNC(rcv.creation_date) >= TRUNC(to_date(@{VAR}{'2017-01-01 12:00:00 AM'},'YYYY-MM-DD HH:MI:SS AM'))

    ReplyDelete
    Replies
    1. Hi Ronald,
      Can give more details about your issue like the error message or error codes, what is your expected result and the business scenario etc.
      Thanks,
      Nagarjuna

      Delete
  6. Hi Venkata, how do we use call_from_date and call_to_date dashboard prompt for direct database request report

    ReplyDelete
  7. Hello,
    Thank you for the blog. This is extremely helpful. My question is since obiee prompts pass value1,value2, . . . when using a prompt with multiple selections. What happens when your data has a comma within the data. A perfect example is a name. i.e. Wayne,Bruce. This will pass through as two different values since there is a comma in the data set.
    Thanks,
    Rico

    ReplyDelete

  8. Great Article. As I read the blog I felt a tug on the heartstrings. it exhibits how much effort has been put into this.
    IEEE Projects for CSE in Big Data

    Spring Framework Corporate TRaining

    Final Year Project Centers in Chennai

    JavaScript Training in Chennai

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

    ReplyDelete
  10. How do we do the all column values with a date?

    ReplyDelete