Set yesterday or some date value as default in OBIEE dashboard prompt

Standard

Aim is to set default value to yesterday or some other day that you desired in dashboard prompt. So, when we click on the dashboard page.

This can be done in many ways

Here I am going to introduce 3 ways of doing the same.

  1. Using Advanced SQL in Prompt (From Answer side)
  2. Using repository variable (From rpd side)
  3. Using derived column in rpd (Same using repository variable)

We discuss this one by one

Using Advanced SQL in Prompt (From Answer side):

  1. Create a prompt on date column as per your requirement
  2. In Default to option drop-down, select SQL Result SQL Result

3.   Now click on eclipse button provided under selected SQL Result option

4.   Write the following query in the editor & click on OK.

(Here I am explaining to set default value to yesterday,)

SELECT CASE WHEN 1=0 THEN Times.”Time Id” else TIMESTAMPADD(SQL_TSI_DAY, -1, CURRENT_DATE) END FROM SH

In general, query will be,

SELECT CASE WHEN 1=0 THEN “any date column”  else TIMESTAMPADD(SQL_TSI_DAY, -1, CURRENT_DATE) END FROM “SubjectAreaName”

Write SQL

5.   Now add this prompt to dashboard page and you will be able to see the prompt is filled with the default value for yesterday

Note: If you want to set some other date as default, you can do that by simply changing the else part of SQL written.

Using repository variable (From rpd side):

1.   Open rpd and go to Manage > Variables… and select new initialization block to creating dynamic repository variable. Select new initialization block option.

2.   Click on Edit Data Source… and write the query & choose the corresponding connection pool as shown below.

Query is:

SELECT CURRENT_DATE – 1 FROM DUAL

(or)

SELECT SYSDATE – 1 FROM DUAL

QueryForVariable

3.   Click on OK to confirm the query (You can test here the query o/p by clicking on Test button)

4.   Click on Edit Data Target… option and click New… to create new repository variable

5.   Give repository variable Name, here I am using YstrDay as Variable Name and click OK

Repository Variable

6.   Click OK and again OK to confirm creation of initialization block.

7.   Save the rpd and go to answers and reload the server metadata.

8.   Go to the prompt you have created already, and this time select Server Variable from Default to option.

Server Variable

9.   Click on Eclipse button under the Server Variable option and mention the repository variable name in editor. i.e. “YstrDay” in my case.

10. Save the prompt and check the default value displayed on dashboard.

Note: Again, if you want to change the default date value to some other you need to change the query written in initialization block of rpd

Using derived column in rpd:

1.   Even this is using repository variable, but this time I am creating dedicated column for this in rpd. So that you can simply make it use without mentioning case when condition in writing query or mentioning the repository variable name

2.   Create a Logical column under Time related table and click on Use existing logical column as the source in order to specify the functionality

3.   Write VALUEOF(YstrDay) in eclipse as functionality

4.   Now in query, of 1st method, you can replace timestampadd thing with Yester Day column you have created in rpd

Note: Here i am using SH rpd. So all objects mentioned here are related to SH schema.

ALL THE BEST

Advertisements

About Kishore & Naresh

Hi.. This is a blog operated by Kishore and Naresh. We are colleagues and working as BI Developers. Here we want to share our ideas and researches here. We were the active members of OTN Forums and inspired with Venkat and John's blog. We may not reach to that level, but we brings up all our ideas and research work we done. All the views expressed here are our own and does not reflect the views of our employers. We need all your blessings and support to grow. Thanks

9 responses »

  1. Nice info.

    But… If I want to limit the user to choose only one date.
    The result will be returned a list of records from a period of five days, which is the start date indicated on the prompt.
    This is possible using variables? how can it be done?

    Regards,
    JC

  2. Hi Kishore and Naresh

    This is Karthik, The thing which u r doing is good to every One
    So many people will respond for the query asked by the groups
    But taking the Inspiraction and going with this is very good
    i like it and like your open book minded any way carry on with the GOOD ………

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s