If you are unable to create a new account, please email support@bspsoftware.com

 

Passing parameter values from one report to another through Java script ?

Started by vemula, 14 Feb 2017 12:30:24 PM

Previous topic - Next topic

vemula

Hello Everyone,

I am new to cognos and java script as well, i got requirement like below

i have two reports
report 1 and report 2

when i click on report 1 heading it popups a window ( it does not re-direct ) and shows report 2 ( wrote java script for this )

Here i am applying multi select filter on report1, the data should filter on report 2 also

when i select one value in filter it is applying on both reports

when it is multi selected then report 2 is filtering with only one value( any value from selection )

my script is like below

<script>
jq(document).on("click","span[lid^='New Business Direct Premiums Written']",function(){
var parentEl = jq(this).closest("table[lid^='DITABLEHOVER']");
var popupWidth = parentEl.width() * 2;
var popupHeight = parentEl.height()-10;
var popupOffset = getPopupOffset(parentEl);
if(jq(".report_popup_iframe").length > 0){
   jq(".report_popup_iframe").remove();
}
var reportPath = "report 2";
var reportParams = getParameterVals();
var reportURL = getReportURL(reportPath,reportParams);
var reportIframe = '<div class="report_popup_iframe" style="position: absolute; margin-left: 0px; '+popupOffset+' margin-top: 0px; width: '+popupWidth+'px; height: '+popupHeight+'px;">';
reportIframe += '<div class="report_iframe_close" style="position: absolute; top:6px; right:8px; font-size: 12px; cursor: pointer; padding: 5px;">X</div>';
reportIframe += '<iframe src="'+reportURL+'" style="width: 100%; height: 100%; border: none;"></iframe></div>';
jq(this).closest("table[lid^='DITABLEHOVER']").parent().prepend(reportIframe);
});
</script>


your help is highly appreciated

Thanks in advance

Regards
Vemula




AnalyticsWithJay

Hello,

There's a much easier way to implement this.

1. Create a Drill-Through link on Report 1 heading.
2. Set the Report property to Report 2.
3. Check the 'Open in new window' property.
4. Edit the parameters to specify which parameters you want to pass.

Ideally, you want to avoid javascript whenever possible as it could break your application during upgrades.

vemula

Thanks Jay for reply

But user does not want that way, on the same window it opens a block with report 2 with close button on the top right

Regards
Vemula

AnalyticsWithJay

Could you alert(reportURL) and paste the contents here? Could you highlight the parameter you're trying to send multiple values of, and what the values you selected are?

On report 2, make sure your filter uses IN() instead of the equal sign (=). If you use '=', Cognos will assume you're looking for a single value.

CognosPaul


dougp

I agree with CognoidJay.  You should use a drill-through.

I don't understand what you are saying about the popup.  Is the requirement for the target report to appear in a new window (or tab) or in the same window?  Either way, this can be controlled in the drill-through definition.

Report 2 filtering only on the first value of a multi-select may be from an error in report 2.  Is the filter using = or in for the operator?