Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Open Crystal report with Procedures using JSP Post Reply Post New Topic
Author Message
KaviVinu
Newbie
Newbie


Joined: 17 Jun 2014
Online Status: Offline
Posts: 2
Quote KaviVinu Replybullet Topic: Open Crystal report with Procedures using JSP
    Posted: 09 Sep 2014 at 9:47pm
Hi,

I am trying to Export simple crystal report to PDF using JSP, This is working perfectly fine. But when I use same piece of code to export complex report which contain more than 2 stored procedures following error is thrown.
(The complex report is working fine in Crystal report 2008/2013 designed tool)

Error:
HTTP Status 500 - javax.servlet.ServletException: com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Failed to bind columns.---- Error code:-2147467259 Error code name:failed


The JSP Code I am using is as follows:
<%
String reportPath;
Object reportSource;
ReportClientDocument reportClientDocument;
ByteArrayInputStream byteArrayInputStream;
byte[] byteArray;
int bytesRead;

reportPath = request.getParameter("_reportName");

/*
* Instantiate ReportClientDocument and specify the Java Print Engine as the report processor.
* Open a rpt file and export to PDF. Stream PDF back to web browser.
*/

reportClientDocument = new ReportClientDocument();

reportClientDocument.setReportAppServer(ReportClientDocument.inprocConnectionString);

reportClientDocument.open(reportPath, OpenReportOptions._openAsReadOnly);

Fields<IParameterField> parameterFields = reportClientDocument.getDataDefController().getDataDefinition().getParameterFields();
if (parameterFields.size() > 0) {
     ParameterFieldController paramController = reportClientDocument.getDataDefController().getParameterFieldController();
     for (int i = 0; i < parameterFields.size(); i++) {

          String paramName = parameterFields.getField(i).getName().trim();
          out.println("                    -          "+paramName);
          System.out.println(request.getParameter(paramName));
          if(request.getParameter(paramName) != null) {
               System.out.println(paramName);
               paramController.setCurrentValue("", paramName, request.getParameter(paramName));
               System.out.println(paramName);
          }else {
               paramController.setCurrentValue("", paramName, "");
               
          }
     }
}

reportSource = reportClientDocument.getReportSource();
session.setAttribute("ReportSource", reportSource);

byteArrayInputStream = (ByteArrayInputStream) reportClientDocument
        .getPrintOutputController().export(ReportExportFormat.PDF);

response.reset();

response.setHeader("Content-disposition", "inline;filename=crreport.pdf");
response.setContentType("application/pdf");

byteArray = new byte[1024];
while((bytesRead = byteArrayInputStream.read(byteArray)) != -1) {
     response.getOutputStream().write(byteArray, 0, bytesRead);     
}

response.getOutputStream().flush();
response.getOutputStream().close();

reportClientDocument.close();

%>


Can anyone help me out on solving this problem?
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.017 seconds.