Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to check a report don't have parameters
Trần Quốc Việt
<p>I'm building a web application and use JSAPI to show report from ihub server to my view, everything look good but still some problem with some report.</p>
<p>My problem is:</p>
<p>"Some report don't have parameters will be show a notification that "This report contains no parameters" when i submit that. " </p>
<p>I want to check the parameters from them before i use comand submit(). Help me! please. Thank</p>
Find more posts tagged with
Comments
Clement Wong
<p>To clarify, you have several reports. And some reports have parameters and some reports do not have parameters</p>
<p> </p>
<p>For those reports without parameters, you want to display an alert before running the report?</p>
Trần Quốc Việt
<blockquote class="ipsBlockquote" data-author="Clement Wong" data-cid="144228" data-time="1465579070">
<div>
<p>To clarify, you have several reports. And some reports have parameters and some reports do not have parameters</p>
<p> </p>
<p>For those reports without parameters, you want to display an alert before running the report?</p>
</div>
</blockquote>
<p>that right, can u help me !!</p>
Clement Wong
<p>JSAPI has a function downloadParameters (<a data-ipb='nomediaparse' href='
http://developer.actuate.com/be/documentation/JAVADOCS/JSAPI-iHub3/symbols/actuate.Parameter.html#downloadParameters'>http://developer.actuate.com/be/documentation/JAVADOCS/JSAPI-iHub3/symbols/actuate.Parameter.html#downloadParameters</a>)
</p>
<p> </p>
<p> </p>
<p>Here's a very simple example of using it to display an alert. If there are parameter, it will render the parameters to the DIV. Otherwise, it will just display the message. The callback of downloadParameters will contain an array (if applicable) of the parameters.</p>
<pre class="_prettyXprint">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" language="JavaScript" src="http://yourInfoConsoleServer:8700/iportal/jsapi"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<script type="text/javascript">
var myRep = "/Home/reports/parameters_galore.rptdesign";
var myParams, myViewer;
function init() {
actuate.load("viewer");
actuate.load("parameter");
actuate.initialize("http://yourInfoConsoleServer:8700/iportal", null, "yourUsername", "yourPassword", getParameters);
}
function getParameters() {
myParams = new actuate.Parameter("myParamContainer");
myParams.setReportName(myRep);
myParams.downloadParameters(checkParameters);
}
function checkParameters(myValues) {
if (myValues != null) {
alert ('There are parameters');
myParams.submit();
}
else {
alert ('There are no parameters');
}
}
</script>
<body onLoad="init();">
<h1>Parameter Test</h1>
<div id="myParamContainer" style="border-width: 1px; border-style: solid;"></div>
</body>
</html></pre>
Trần Quốc Việt
<blockquote class="ipsBlockquote" data-author="Clement Wong" data-cid="144250" data-time="1465858709">
<div>
<p> </p>
<p>JSAPI has a function downloadParameters (<a data-ipb='nomediaparse' href='
http://developer.actuate.com/be/documentation/JAVADOCS/JSAPI-iHub3/symbols/actuate.Parameter.html#downloadParameters'>http://developer.actuate.com/be/documentation/JAVADOCS/JSAPI-iHub3/symbols/actuate.Parameter.html#downloadParameters</a>)</p>
;
<p> </p>
<p> </p>
<p>Here's a very simple example of using it to display an alert. If there are parameter, it will render the parameters to the DIV. Otherwise, it will just display the message. The callback of downloadParameters will contain an array (if applicable) of the parameters.</p>
<pre class="_prettyXprint">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" language="JavaScript" src="http://yourInfoConsoleServer:8700/iportal/jsapi"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<script type="text/javascript">
var myRep = "/Home/reports/parameters_galore.rptdesign";
var myParams, myViewer;
function init() {
actuate.load("viewer");
actuate.load("parameter");
actuate.initialize("http://yourInfoConsoleServer:8700/iportal", null, "yourUsername", "yourPassword", getParameters);
}
function getParameters() {
myParams = new actuate.Parameter("myParamContainer");
myParams.setReportName(myRep);
myParams.downloadParameters(checkParameters);
}
function checkParameters(myValues) {
if (myValues != null) {
alert ('There are parameters');
myParams.submit();
}
else {
alert ('There are no parameters');
}
}
</script>
<body onLoad="init();">
<h1>Parameter Test</h1>
<div id="myParamContainer" style="border-width: 1px; border-style: solid;"></div>
</body>
</html></pre>
</div>
</blockquote>
<p>Thank you so much
</p>
Trần Quốc Việt
<p>Finally i have found the way to solve this problem. My code similar bellow:</p>
<pre class="_prettyXprint _lang-js">
param = new actuate.Parameter("parameters"); // "parameters" is id of div element to show parameter
param.setReportName(url);
var isParam = false;
param.downloadParameters(function(myValues){
if(!myValues){
var myValues = [];
}
for(var j = 0; j<myValues.length; j++){
if(myValues[j]._._isHidden == true){
isParam = true;
}
}
if(isParam == true){
// var myEl1 = angular.element(document.querySelector('#viewerpane')); (I want to use them but dont work)
// myEl1.empty();
param.submit();
} else {
var myEl = angular.element(document.querySelector('#parameters'));
myEl.empty();
var viewer = new actuate.Viewer("viewerpane"); //viewerpane is id of div element to show report
viewer.setReportName(url);
viewer.submit();
}
</pre>