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)
JSAPI - How to Initialize Cascading Report Param?
richardcooper25
<p>Hi,</p>
<p> </p>
<p>I'm wondering if you can help me with some JSAPI code. (I am using a custom application which embeds a BVT report in an html page.)<br><br>
I have a dataset ('Regions') which is linked to a hidden report parameter ('reportOwner').<br>
The Regions dataset is used by a cascading report parameter ('userRegions').<br><br>
I want to (1) set the hidden report parameter ('reportOwner') to a value using JSAPI code in the browser page (this I can do) and (2) refresh the cascading report parameter ('userRegions') so that the Regions dataset it uses gets updated corresponding to the new value of the reportOwner report parameter. All of this should occur before displaying the parameters on the browser page.<br><br>
I can get (1) to work using the code below, but not (2) - the cascading report parameter ('userRegions') still displays the original list of values.<br><br>
</p>
<pre class="_prettyXprint">
<script>
var param;
var viewer;
var reportPath;
var url='${reportViewerUrl}';
reportPath = "/crm_charts/crm_rep_calls_chart.rptdesign";
function initReport() {
if (!actuate.isConnected(url, null)){
actuate.load('viewer');
actuate.load('parameter');
actuate.initialize( url, null,null,null,displayParams );
} else {
displayParams();
}
}
function displayParams(){
$('#param-container').css('border-width', 1);
param = new actuate.Parameter( 'param-container' );
param.setReportName(reportPath);
param.submit( function () {this.descriptionbox.style.visibility = 'visible'; this.reportTitleBox.style.visibility = 'visible';});
param.downloadParameters(setUser);
}
function setUser( paramdefs ) {
// Iterate through params and update the reportOwner param
for(var i=0; i<paramdefs.length; i++){
if(paramdefs[i].getName() == 'reportOwner') {
paramdefs[i].setDefaultValue(1);
}
}
param.renderContent(paramdefs);
}
...
</script>
</pre>
<p>Any help much appreciated.</p>
<p> </p>
<p>Cheers,</p>
<p> </p>
<p>Richard</p>
Find more posts tagged with
Comments
richardcooper25
<p>Solved</p>
<p>All report params being updated should be inside the same cascading parameter group. That way, when one gets updated, the others are triggered to update.</p>
<p>I hid the first parameter that gets updated using param.hideParameterName(paramNameArray).</p>