开发者

Using CrystalReportViewer how to view data from the rpt file and NOT database?

开发者 https://www.devze.com 2023-02-14 06:05 出处:网络
Using CrystalReportVie开发者_如何转开发wer how to view data from the rpt file after filtering and NOT go in the database for fetching the data. The rpt file already contains all data. I am working on

Using CrystalReportVie开发者_如何转开发wer how to view data from the rpt file after filtering and NOT go in the database for fetching the data. The rpt file already contains all data. I am working on java.

here is my code in jsp. What changes do i need to make?

// ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************  
    {
        // Create the CrystalReportViewer object
        CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();

        String reportSourceSessionKey = reportName+"ReportRerunSource";
        Object reportSource = session.getAttribute(reportSourceSessionKey);
        reportSource = clientDoc.getReportSource();
        session.setAttribute(reportSourceSessionKey, reportSource);
        //  set the reportsource property of the viewer
        crystalReportPageViewer.setReportSource(reportSource);

        // Apply the viewer preference attributes
        crystalReportPageViewer.setOwnPage(true);
        crystalReportPageViewer.setHasLogo(true);
        crystalReportPageViewer.setEnableParameterPrompt(false);
        crystalReportPageViewer.setHasToggleParameterPanelButton(false);
        // Process the report
        crystalReportPageViewer.processHttpRequest(request, response, application, null); 

    }
    // ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************  


You need to store the entire values what you required in a Dataset when you retrieve at first, and later setting the Report viewer's source to the Dataset.

The values present in the Dataset can be loaded to the Report view by going, Database Expert --> Create New Connection --> Connect to the Server and on right clicking add a new Command, after adding the command the every column you have given in the Command will appear, so you can display them by dragging and dropping from the Field Explorer to the Report Viewer.

Hope it will help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消