cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports hangs indefinitely on refresh after export/print.

Former Member
0 Kudos

I'm using Crystal Reports for VS 13.09 on an IIS 7 server. The application works fine except for in this one scenario. I can print or export fine, and I can refresh fine, but if I print or export and then try to refresh the "Please wait while the document is being processed." box comes up and never goes away. After printing/exporting I can still use the breadcrumb links and forward/back buttons with no problems, it's just refresh that causes issues.

Here is the ASPX I'm using:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewReport.aspx.cs" Inherits="Intranet.ViewReport" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=14.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<!DOCTYPE html>

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

<head runat="server">

    <meta http-equiv="X-UA-Compatible" content="IE=9,chrome=1" /> 

    <title></title>

</head>

<body>

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

    <div>

        <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" Width="960px" HasRefreshButton="True" HyperlinkTarget="_blank" />

    </div>

    </form>

</body>

</html>

And here is the code:

using CrystalDecisions.Enterprise;

using CrystalDecisions.ReportAppServer.ClientDoc;

using IBM.Data.Informix;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace Intranet

{

    public partial class ViewReport : System.Web.UI.Page

    {

        protected Connections sqlObj = new Connections();

        EnterpriseSession myEnterpriseSession;

        ReportClientDocument myReportDocument;

        protected void Page_Load(object sender, EventArgs e)

        {

            if (IsPostBack)

            {

                CrystalReportViewer1.ReportSource = (ReportClientDocument)Session["myReportDocument"];

            }

            else

            {

                BindingUsingReportAppFactory();

            }

        }

        void BindingUsingReportAppFactory()

        {

            try

            {

                Session["ReportPath"] = Request["ReportPath"];

                Session["Logon"] = Request["Logon"];

                myReportDocument = LoadReport(Session["ReportPath"].ToString());

                if (Request.UrlReferrer.ToString().Contains("/salesintranet.aspx"))

                {

                    string selectionText;

                    selectionText = myReportDocument.DataDefController.RecordFilterController.GetFormulaText();

                    if (selectionText != null)

                    {

                        int asteriskPos = selectionText.IndexOf('*');

                        if (asteriskPos > 0)

                        {

                            selectionText = selectionText.Substring(0, asteriskPos) + Session["Logon"] + selectionText.Substring(asteriskPos, selectionText.Length - asteriskPos);

                            myReportDocument.DataDefController.RecordFilterController.SetFormulaText(selectionText);

                        }

                    }

                }

                Session["myReportDocument"] = myReportDocument;

                CrystalReportViewer1.ReportSource = (ReportClientDocument)Session["myReportDocument"];

                LogReport('Y');

            }

            catch (Exception ex)

            {

                LogError(ex);

                LogReport('N');

                Response.Write("<html><body><h3>Request failed.</h3>");

                Response.Write("The document could not be loaded.<br />Please hit back to try again.<br />");

                Response.Write("If you are still unable to load the report, please contact IT.</body></html>");

                Response.End();

            }

        }

        ReportClientDocument LoadReport(string reportPath)

        {

            SessionMgr mySessionMgr = new SessionMgr();

            myEnterpriseSession = mySessionMgr.Logon("XXXX", "XXXX", "XXXX", "XXXX");

            EnterpriseService myEnterpriseService = myEnterpriseSession.GetService("InfoStore");

            InfoStore myInfoStore = new InfoStore(myEnterpriseService);

            myEnterpriseService = myEnterpriseSession.GetService("RASReportFactory");

            Object rrfObject = myEnterpriseService.Interface;

            ReportAppFactory myReportAppFactory = (ReportAppFactory)rrfObject;

            string query = "Select SI_ID from CI_INFOOBJECTS WHERE SI_NAME LIKE '" + reportPath + "'";

            InfoObjects myInfoObjects = myInfoStore.Query(query);

            InfoObject myInfoObject = myInfoObjects[1];

            return myReportAppFactory.OpenDocument(myInfoObject.ID, 0);

        }

Any suggestions on what might be the problem here?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Limitation of the Page_Load event, move your code to the Page_Init then it should work.

Not a CR issue but a basic WEB app recommendation to load everything in the Init and not in the Load event.

Don

Former Member
0 Kudos

I've tried that as well and had the same problem.

0 Kudos

Hi Ben,

You can't be using CrystalDecisions.Web, Version=14.0.3500.0, Culture=neutral... and CR for VS 13.09 in the same app.

That is likely the issue. Use one or the other, not both. CR for VS doesn't have any Enterprise dll so you can't query the CMS to get a report using 13 runtime.

Looks like you are mixing the CR for VS with BI 4.0 .NET SDK...

Don

Former Member
0 Kudos

Aside from this one issue it appears to be working fine. We've got a couple hundred reports in the CMS and they all load without issue and navigate without issue except for refresh breaking upon print/export. This seems more to be a bug with that process than something that's not supposed to work. I know I had to replace the CrystalImageHandler class in my project due to a bug with images in reports ( read here for details: CR for VS SP09 - Embedded images not showing in... | SCN ). There are also posts elsewhere on this forum where people had similar issues with print breaking the report ( for example) with no resolution posted. While this might be a problem with my code or the built-in functionality, I don't believe the issue is a compatibility problem as you suggest.

0 Kudos

Up to you, if you don't want to use versions that work with each other then not much we can do about it. The bug is one version maybe calling an API entry point in the other version that doesn't exist.

Use all one version, if you can still replicate the issue then I'll track it, otherwise, try rebuilding you report and make sure you don't use NEW API's in SP 9 that may not be in version 14 runtime.

Uninstall CR for VS and then repair the BI 4.0 .NET SDK and see if it still works, replacing the version 13 assemblies in your app.config/web.config file. If it's still an issue then update BI 4.0 .NET installer to the latest SP and test again.

Also, if you are using BI 4 SDK you have a support ocntract, log a case and a Rep can work with you to resolve the runtime and issue.

Try a simple "one liner" app and that report, export it to RPT format so it has saved data and see if that works.

Good luck

Don

Former Member
0 Kudos

The reason I ended up using both is because there were not any useful code examples I could find for using BI 4.0 .NET SDK the way I am doing above. What I could find all required CR for VS components.

I don't believe the issue has anything to do with using both because the print, export, and refresh functionality is all built into CR for VS. If there were an issue it would make sense to have it pop up when loading the document into the crystalreportviewer; having it occur specifically when using the functionality that CR for VS provides (print, export, and refresh) which all work fine on their own doesn't make sense.

0 Kudos

The issue is CR for VS does not ship this component or any CR.Enterprise assemblies:

using CrystalDecisions.Enterprise;

So therefore not tested and not supported.

All I can suggest is you start removing parts from the bad reports and find out what is causing the problem and deal with it, nothing SAP can do to fix this.

Or update your application to use ALL 14.x assemblies. If the reports are still a problem try the latest patch, it should have the fix in it or the next release. If it's still a problem log a case in SMP and we can determine the cause and get R&D to fix it for BI 4.x .NET SDK.

Don

Answers (0)