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

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Send Report to Byte array

Started by CarlGanz, 15 Jan 2010 08:19:50 AM

Previous topic - Next topic

CarlGanz

I'm rather new to Cognos development and have a question about a project that was handed to me. One of the developers here found the following code in a Cognos sample and we use it to pass in a series of parameters to a report. The Run() method exports the report to a PDF or XLS file on disk.

Two questions:

1. Is there any way to return the Cognos report as a byte array instead of a disk file?

2. If there any way to get better error messages that simply "Client Error"? I was passing in the output type (PDF, XLS) as lower case and it took me over an hour to figure out that it had to be uppoer case because all we got back was "Client Error"

Thanks

Carl

        public void BurstReport(Dictionary<string, string> reportparametervalues, string outputType)
        {
           
            reportParameterValues = reportparametervalues;
            searchPathSingleObject reportPath = new searchPathSingleObject();
            reportPath.Value = string.Format(this.reportServerPath); //"/content/folder[@name='Website report development']/report[@name='testreportmembergroup']";

            // Create a connection to Cognos 8.

            string Server_URL = "http://" + serverHost + ":" + serverPort + "/p2pd/servlet/dispatch";
            reportService1 reportService = new reportService1();
            reportService.Url = Server_URL;

            // Set up the biBusHeader for a logon.
            if (userName.Length > 0 && userPassword.Length > 0 && userNameSpace.Length > 0)
            {
                setUpHeader(reportService, userName, userPassword, userNameSpace);
            }
            reportParameterList = this.getReportParameters(reportPath.Value, reportService);

            parameters = this.setReportParameters(reportParameterList);

            //outputType MUST be upper case or Cognos will return a Client Error
            SetRunOptions(ref runOptions, outputType.ToUpper());

            reportService.Timeout = ReportServerTimeout;
                       
            asynchReply result = reportService.run(reportPath, parameters, runOptions);
        }