cancel
Showing results for 
Search instead for 
Did you mean: 

CR Viewer takes a while to load (Code Review)

Former Member
0 Kudos

Hello -

Issue Background:

I've created an application that utilizes the CR Viewer. Sometimes it loads quickly, other times not so much. This morning I received a support ticket explaining that a report was coming back blank, and that it took 45 minutes to run!

I tested it on the web server (2012 R2 - Virtual) and sure thing it is taking forever to run. Tried running the app from localhost on my machine and it displayed within 5 minutes. Next, I ran the sql script (SQL Server 2012) and its taking the script 4 minutes to run (I didn't write it) - obviously this needs to be optimized!

Question:

Is there a setting I can set within the CR viewer so it doesn't timeout and return a blank document when run from the Web server? Why would the web version take so much longer to run - I've seen times from 18 minutes to 45 minutes.

Environment:

VS 2013 Professional

SQL Server 2012

Desktop Win 7

Web Server 2012 R2

Crystal Reports Developer V13

Crystal Reports Designer we have reports that are built using 2008 & XI

HTML Code:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Viewer.aspx.vb" Inherits="Unconfirmed.Viewer" %>

<%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

 

        <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" EnableDatabaseLogonPrompt="False" HasCrystalLogo="False" Height="50px" Width="350px" />

 

    </div>

    </form>

</body>

</html>

Code Behind:

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared

Imports CrystalDecisions.Web

Imports Unconfirmed.Components.Framework

Public Class Viewer

    Inherits System.Web.UI.Page

    Private rptPath As String = ""

    Private rptDoc As ReportDocument

    Private strAuthUser As String = ""

    Private _config As New Config

    Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init

        ConfigureCrystalReports()

    End Sub

    Private Sub ConfigureCrystalReports()

        rptDoc = New ReportDocument

        Try

            rptPath = _config.ReportPath + Session("SelectedReport").ToString

            rptDoc.Load(rptPath)

            rptDoc.SetDatabaseLogon(_config.CrystalUser, _config.CrystalPassword)

            CrystalReportViewer1.ReportSource = rptDoc

        Catch ex As Exception

            Response.Write("There has been an error processing the file at: " + rptPath + " || Exception Message: " + ex.Message.ToString + "  ||  Exception Inner Message: " + ex.InnerException.ToString)

        End Try

    End Sub

    Private Sub form1_Unload(sender As Object, e As EventArgs) Handles form1.Unload

        Me.rptDoc.Close()

        Me.rptDoc.Dispose()

    End Sub

End Class

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Herb

There may be a number of reasons:

1) Is the same version Database client used in the web all as on local host or CR Designer? Note that a better practice may be to update the reports to CR 2013 (v. 14.1.x) and then see how these run in the web app. SAP Crysta Reports 2013, 30 day eval can be downloaded from here:

SME Free Trials | SME Software | SAP

2) Depending on the report design, avoid using the special field N of M as this forces the report engine to bring in all the data and render the report once that is done.

3) Subreports. If there is too many of these, the report will slow down as a subreport is a report by any other name, so running a report with 2 subreports actually equates to running three reports at the same time. Also, subreports in a detail section run once per each record. So, one subreport in a detail section that returns 1000 records will run 1001 reports.

4) If there are any changes made to the database, the report may need to verify these. Enabling the option Verify on 1st refresh will often resolve performance issues, but you do not want to do this all the time as the verify has it's own performance penalty.

And lastly, I am not sure what SP for CRVS you are using, but updating to SP 14 will be a good idea. See

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Answers (0)