Oracle® Business Intelligence Presentation Services Administration Guide > Administering Oracle BI Answers > Blocking Requests in Answers >
Blocking Requests Based on Criteria
Answers calls your validateAnalysisCriteria function when the user tries to execute the request. The function can return True if the request is not blocked, or False or a message if the request is blocked. If a message or a value other than False is returned, the message is displayed in a popup window. In either case, the query is blocked.
The following code example shows the blocking of a query.
<?xml version="1.0" encoding="utf-8"?>
<WebMessageTable system="QueryBlocking" table="Messages">
<WebMessage name="kuiCriteriaBlockingScript" translate="no">
Sample blocking script in .../OracleBIData/web/res/myblocking.js
// This is a blocking function. It makes sure users pick what I want them to.
// Create the helper object
var tValidator = new CriteriaValidator(analysisXml);
// Validation Logic
if (tValidator.getSubjectArea() != "Paint")
return "Why don't you try Paint?";
// If validation script notifies user, then return false
alert("Region and District go so well together, don't you think?");
if (!tValidator.dependentColumnExists("Sales Measures","","Periods","Year"))
return "You picked a measure so pick Year!";
if (!tValidator.filterExists("Sales Measures","Dollars"))
return "Why don't you filter on Dollars?";
return "Since you're showing specific Markets, please filter the markets.";
var n = tValidator.filterCount("Markets","Region");
if ((n <= 0) || (n > 3))
return "Please select 3 or fewer specific Regions";
If you do not override the function using the template as described previously, or if the function returns anything other than False, the criteria is considered to be valid and the request is issued. The criteria is validated using this same mechanism for preview and save operations as well.