OBIEE by Shiva Molabanti

An Oracle Business Intelligence Enterprise Edition weblog

OBIEE IS BETWEEN Date Validation for dashboard prompt

Posted by Shiva Molabanti on April 21, 2009

Normally when we are working with Calendar date with Between operator we are not seeing any alert message if the user enters the inappropriate dates.
For this we need to some workaround to alert the user for proper dates to input.
To validate date for correct format I have already posted in this blog: http://shivabizint.wordpress.com/2009/04/13/date-validation-for-dash-board-prompt-calendar-control/

Now to alert the user if he is entering inconsistent dates for Between operator we need to add simple code in globalfilterprompt.js.you need to alter this file in two locations

1.\OracleBI\web\app\res\b_mozilla\prompts
2.\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\b_mozilla\prompts

Steps to do:
Step1: As usual take a backup of your globalfilterprompt.js otherwise you will loss the actual behavior of the prompt if you not done properly.
Step2: Open Globalfilterprompt.js and search for the if (sNewOp == “between”) loop.
And add the following code in this loop after values declaration.

Code snippet:
if(sVal2 < sVal)
{
alert(“Value-2 should be greater than Value-1″);
}

Step3: Now your if (sNewOp == “between”) should be like this

if (sNewOp == “between”)
{
var sVal = tValues[0];
var sVal2 = tValues[1];

// var bVal = (sVal && (sVal != ksDropDownAllChoices) && (sVal != ksEditBoxAllChoices));
// var bVal = (sVal2 && (sVal2 != ksDropDownAllChoices) && (sVal2 != ksEditBoxAllChoices));
if (sVal == ksDropDownAllChoices || sVal == ksEditBoxAllChoices || sVal == ksDropDownNone)
sVal = “”;

if (sVal2 == ksDropDownAllChoices || sVal2 == ksEditBoxAllChoices || sVal2 == ksDropDownNone)
sVal2 = “”;

//Shiva code for BETWEEN Operator//

if(sVal2 < sVal)
{
alert(“Value-2 should be greater than Value-1″);

}
//Shiva code for BETWEEN Operator//

if (!(sVal && sVal2))
{
if (!sVal && sVal2)
tF.sOp = “lessOrEqual”;
else if (sVal && !sVal2)
tF.sOp = “greaterOrEqual”;
else
tF.sOp = “prompted”;
}
}
Step4: Now restart Oracle BI Java Host and Oracle BI Presentation server and also OC4J for better results (I am always doing this).

Now check the Date with between parameter to alert user:

datebetween12

Till next time…

Posted in OBI EE | 4 Comments »

Case Insensitive Search Using Dashboard Prompt

Posted by Shiva Molabanti on April 20, 2009

To make case insensitive search If you look in the configuration guide you will find that the CASE_SENSITIVE_CHARACTER_COMPARISON parameter in the NQConfig file controls the case sensitive search within OBIEE. But this configuration cannot make your search as case insensitive. Be aware that you might be fooled by your database settings. If you are on an Oracle database 10G+ you can use a connection script in the repository to allow case insensitive searches. (John has posted about this in his blog http://obiee101.blogspot.com/2009/02/obiee-configuring-case-insensitive.html)

But if you don’t have access to database to do all these steps. Then you need to configure your filter behavior in OBIEE application itself.

To do this we need to alter the code in columnfilterprompt.js In following two  locations:

1.\OracleBI\web\app\res\b_mozilla\prompts

2.\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\b_mozilla\prompts

Steps to do:

  1. Take a backup of columnfilterprompt.js (if something goes wrong then you are unable to use this column filter)
  2. Open Columnfilterprompt.js in a editor and search for the function

function CFPRefresh(sViewID, sType, numPageValues, sDisplay, sFilter, sCallFunction, bNoRefresh)

{

——–

——–

——–

if(document.getElementById(sViewID + “MatchTable”))

{

//if (tForm.Constraint.value != “”)

{

var sValue = null;

switch (tForm.Match.value)

{

case “beginsWith”:

sValue = CFPSqlEscape(tForm.Constraint.value) + “%”;

break;

case “endsWith”:

sValue = “%” + CFPSqlEscape(tForm.Constraint.value);

break;

case “contains”:

sValue = “%” + CFPSqlEscape(tForm.Constraint.value) + “%”;

break;

}

if (sValue != null)

sWhere = aColumns[0] + ” LIKE ‘” + sValue + “‘”;

}

}

——

——

}

3. Now comment the bold content i.e sWhere = aColumns[0] + ” LIKE ‘” + sValue + “‘”; and add this code  in  if (sValue != null) loop.

Code:

sWhere = “UPPER(“+aColumns[0]+”)” + ” LIKE UPPER(‘” + sValue + “‘)”;

4. Now your code should look like this:

function CFPRefresh(sViewID, sType, numPageValues, sDisplay, sFilter, sCallFunction, bNoRefresh)

{

——–

——–

——–

if(document.getElementById(sViewID + “MatchTable”))

{

//if (tForm.Constraint.value != “”)

{

var sValue = null;

switch (tForm.Match.value)

{

case “beginsWith”:

sValue = CFPSqlEscape(tForm.Constraint.value) + “%”;

break;

case “endsWith”:

sValue = “%” + CFPSqlEscape(tForm.Constraint.value);

break;

case “contains”:

sValue = “%” + CFPSqlEscape(tForm.Constraint.value) + “%”;

break;

}

if (sValue != null)

//sWhere = aColumns[0] + ” LIKE ‘” + sValue + “‘”;

sWhere = “UPPER(“+aColumns[0]+”)” + ” LIKE UPPER(‘” + sValue + “‘)”;

}

}

—–

—–

—-

}

5. Now restart Oracle Java host service and Presentation service for better results restart OC4J also.

6. Now check the prompt with different case letters and observe that it returns values.The same code is useful in multiselect constarint choice also.

case-insenstive

Till next time…

Posted in OBI EE | 5 Comments »

OBIEE Dashboard Page State Persistence

Posted by Shiva Molabanti on April 14, 2009

When you are viewing a report which was configured to “drill in place” in section.
You might observe that the drill down reports in Dashboard Pages are not displaying results which are related to that; instead it displays results which are last seen on that particular Dashboard Page where you drilled down from its level.
For e.g.: I have a report which has drilled down from year to month in dashboard.

drilldown1

Now if you click on the Drill down Test page still I am seeing the same granular level report instead of original report;

drilldown2

This is because our OBIEE is maintaining the dashboard page state by default.
To handle this we need to configure page state maintenance and for this add PersistPageState parameter in instanceconfig.xml as it determines whether page state is persisted when moving between pages on a dashboard. By default this parameter was set to “True” now change this value to “False”.

The parameter you have to add in instance config.xml after <ServerInstance>element is:

 <PersistPageState>FALSE</PersistPageState>

Now restart the Presentation server and Java host, check the reports and see that the dashboard page not maintains its page state.

drilldown3

till next time…

Posted in OBI EE | 1 Comment »

Date validation for Dash board prompt Calendar control

Posted by Shiva Molabanti on April 13, 2009

One the question you see regularly on the forums is how to validate date in dashboard prompt if more important with the use of the calendar control.

calendar-inputs2In OBIEE the Date validation for Calendar control is not happening when user tries to enter any invalid dates (i.e. Dates in invalid formats and strings).otherwise if you select from the calendar pop up window it works good.

calendar-error1

Because of this date column mismatching at date data type we are getting error in our Reports.

So to make it fair we need to handle the calendar control input values if the user enters directly.

For this we have to change the calendar control functionality when the user hits the ‘Go” button in dashboards as Go button is sending our prompt input values to reports.

In OBIEE the GO button functionality was defined in globalfilterprompt.js. It is located in two locations

1. <install_dir>\OracleBi\web\app\res\b_mozilla\prompts

2. <install_dir>\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\b_mozilla\prompts

For example let’s validate the date to dd/mm/yyyy or dd-mm-yyyy format

Open globalfilterprompt.js and search for the GFPFixDateTime() function it is the function which handles the calendar control date.

function GFPFixDateTime(sDate, sPrefix)

{

 if (/*(sDate == ksDropDownUnspecified) || */(sDate == ksDropDownAllChoices) || (sDate == ksEditBoxAllChoices))

  return sDate;

 // check for null or just whitespace

 else if (sDate == null || sDate.search(/^\s*$/) != -1)

  return “”;

 else

  return (sDate);

}

Now here we need to change the existing behavior of this function.

Step1: Make sure that you should taken a back up of this file as if you not done this changes properly it will effects the prompts behavior and breaks the pages to work.

Step2: Comment/Delete the code (here I made it in Bold) in this function GFPFixDateTime(sDate, sPrefix)

Step3: Add the following code to  function GFPFixDateTime(sDate, sPrefix)  and now your code should look like this:

 function GFPFixDateTime(sDate, sPrefix)

{

////////////////////////SHIVA DATE VALIDATION CODE/////////////////////////////////////////////

var sDisplayDate = “31/12/1960″;  //To make this date as default date if  you entered wrong format date //

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;  //Validating the date with Regular expression//

var matchArray = sDate.match(datePat);

if (matchArray == null) {

alert(“Please enter date as either dd/mm/yyyy or dd-mm-yyyy.”);

return sDisplayDate;

}

day = matchArray[1];

month = matchArray[3];

year = matchArray[5];

if (month < 1 || month > 12)  //To validate month number in date//

{

alert(“Month must be between 1 and 12.”);

return sDisplayDate;

}

if (day < 1 || day > 31)   //To validate Day no in Date//

{

alert(“Day must be between 1 and 31.”);

return sDisplayDate;

}

if ((month==4 || month==6 || month==9 || month==11) && day==31) //To validate correct no of days in month//

{

alert(“Month “+month+” doesn’t have 31 days!”)

return sDisplayDate;

}

if (month == 2)  //To validate  no of days in Feb month based on year//

{

var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));

if (day > 29 || (day==29 && !isleap)) {

alert(“February ” + year + ” doesn’t have ” + day + ” days!”);

return sDisplayDate;

}

}

return (sDate);

////////////////////////SHIVA DATE VALIDATION CODE/////////////////////////////////////////////

}

Step4: Make the steps 1, 2 and 3 in two locations.

Step5: Restart Oracle BI Java host and Oracle BI Presentation server and also OC4J (For better results clear your browser cache and history).

 Now open the OBI Dashboard and give the input values to calendar control.

calendar-alert1

 

 

 

 

calendar-alert2

If you click the ok button of this alert box then you will see the report like this

calendar-message12

If you observed the Date value in message it is taking date “31/12/1960”.This is because we have fixed this in Our code to make as default date for calendar

if any wrong input entered by User.(For me I don’t have data before 31/12/1960 even you should  make sure the date for which you don’t have any data)

To avoid this message add no-results view in your answers report.

 no-results

 

Add message to No Results View

no-results-message

Now check the Report in Dashboard with proper validaton and Message:

calendar-message2

In this Post I have validated the date only for dd/mm/yyyy or dd-mm-yyyy format.If you want to validate in your own format you can validate in the same way how i have done.

Posted in OBI EE | 6 Comments »

Showing both X-axis and Y-axis values in Scatter chart Tooltip

Posted by Shiva Molabanti on February 11, 2009

Normally in a scatter chart when we are showing the tooltip, we are seeing only Y-Axis values but making some alternations we can include both the x-axis and y-axis values in the tooltip.

 For this you need to alter scatter.pcxml file.
you have to update this file in two locations.
1.\OracleBI\web\app\res\s_<stylename>\popbin
2.\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_<stylename>\popbin

 in this scatter.pcxml file
in between <Graph> tag search for Datalabels tag,here you have to identify formatstring value like this:

 <DataLabels Font=’Size:9;Style:Bold;’ TransparentBackground=’False’ BGColor=’#FFFFFFcd’ FormatString=’%_XVALUE&#xA;%_YVALUE’ />

It will give you both X and Y values at your Tooltip. Where &#xA; is for new line character in xml.

I tried this example using paint.rpd’s Region, Brand and dollars and this is screen shot for X and Y values at tool tip.

  scatterxytooltip

Posted in OBI EE | 1 Comment »