Basic report design

Using Report Manager from javascript

This is a sample was provided by pirate no beard [jorr@comtekadvanced.com], at Yahoo reportman group:

>>> Quoted

Here's a javascript class I wrote to facilitate launching reports as PDFs from pages on our intranet. It's very simple but works for me so I thought I would share it. Note that the class automatically opens reports from the report group "RMREPORTS", uses the "guest" account and refers to a copy of repwebserver.dll in the directory /cgi-bin. That can be modified easily enough by changing the lines in the "Properties" section.

Sample usage:
--
var oReport = new RMReport("REPORT_NAME"); oReport.AddParameter("PARAMNAME1","value1");
oReport.AddParameter("PARAMNAME2","value2");
oReport.Launch();
--

Actual code:
--

// Defines object "RMReport" and methods // for creating and linking to reports in // Report Manager.

function RMReport(name)
{
// properties

this.parameterNames = new Array();
this.parameterValues = new Array();
this.baseUrl = "/cgi-bin/repwebserver.dll/execute.pdf?
reportname=" + name + "&aliasname=RMREPORTS&username=guest";

this.Url = iUrl;
this.AddParameter = iAddParameter;
this.Launch = iLaunch;

// functions

// build the Url for the report.
function iUrl()
{
var url = this.baseUrl;
for(var i=0;i<this.parameterNames.length;i++)
url+= "&Param" + this.parameterNames[i]
+ "=" + this.parameterValues[i];
return url;
}

// add a parameter to the report.
function iAddParameter(name,value)
{
this.parameterNames[this.parameterNames.length]=
name;
this.parameterValues[this.parameterValues.length]=
escape(value);
}

// launch the report in a new window.
function iLaunch()
{
window.open(this.Url());
}
}

--