URL Link to SubReport trick (7.x and 8.x versions)

(imported topic written by brolly3391)

This trick is unofficial, unsupported and subject to breakage on Web Reports upgrades. With that out of the way, have you used “links of bes computers” in a report before and wondered “What if I could create other interesting links that allowed for drilling down into a report with subreports in a configurable and flexible way?”

In BES 7.x, you can enter a URL to jump directly to a report:

http://brollybes7/webreports?page=Report&ReportID=23

where brollybes7 is my 7.x Web Reports server and ReportID=23 is some custom report that I created.

Now if report 23 was constructed as below:

<body> <div id=
"ResultsDiv">Processing...</div> </body> <script type=
'text/javascript'>   function param()
{ 
//get the param from the URL var regex = 

new RegExp( 
"[\\?&]Subnet=([^&#]*)" ); var results = regex.exec( window.location.href );   
//build the dynamic session relevance statement based on the subnet passed var Relevance = 
'names of computers of results whose (exists values whose (it as string as lowercase = "' + results[1] +
'") of it ) of bes properties whose (name of it as lowercase = "subnet address" AND not analysis flag of it))'; var RelRes = EvaluateRelevance(Relevance);   
// stick the result into the existing div and go have a chai latte ResultsDiv.innerHTML = RelRes; 
}   
// this part just makes the javascript "go" when the report loads. window.onload = param();   </script>

then I can pass it parameters. I used &Subnet= as my parameter but you could use others and/or multple parameters with this approach. I can now extend the previous URL by adding an additional &param=value portion.

http://brollybes7/webreports?page=Report&ReportID=23&Subnet=0.0.0.0

Now I can potentially construct other reports that have links that pass the subnet parameter and call this report. I do need to know the web report server URL and the ReportID, which will be some other number than 23 on your Web Reports server. Just open the report and check the URL listed in your browser. Test the report by adding the &Subnet=1.2.3.4 parameter to the URL.

Example of main Report calling Subreport23

<body> <?relevance table of concatenation of trs of tds of anchors(
"href=%22http://BROLLYBES7:52312/webreports?page=Report&ReportID=23&Subnet=" & it & 
"%22") of (elements of ((set of unique values of values of results of bes properties whose (name of it as lowercase = 
"subnet address" AND not analysis flag of it))- (set of (unique values of values of results (bes properties whose (name of it as lowercase = 
"subnet address" AND not analysis flag of it),BES Computers whose (relay server flags of it))))))?> </body>

Cheers,

Brolly

(imported comment written by brolly3391)

For 8.0 you need to change

var results = regex.exec( window.location.href );

into

var results = regex.exec( parent.location.href );

and the calling link needs a small modification. Change

http://brollybes7/webreports?page=Report&ReportID=23&Subnet=0.0.0.0

into

http://brollybes7/webreports?page=CustomReport&ReportID=23&Subnet=0.0.0.0