cancel
Showing results for 
Search instead for 
Did you mean: 

Cancel Report Load while in progress

laszloszijarto
Explorer
0 Kudos
468

In the event of a report that might take a very long time to load, is there any way to stop the load while it's in progress?  When setting the ReportSource, and while the load is in progress, the entire app form locks up, even if I try setting the ReportSource in a background worker thread.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Lazslo

Unfortunately, not really... you could spawn the report on another thread and in that way your main form / app does not get "locked".


See the following for more info:

KBA 1439745 - How to improve performance of a Crystal Report in VB. NET application on load of first rep...

KBA 1583132 - Error "ThreadStateException was unhandled" occours when running Crystal Reports in a multi...

KBA 1613561 - How to call a Windows form containing the CrystalReportViewer control on a separate thread

- Ludek

Senior Support Engineer AGS Primary Support, Global Support Center Canada

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Share Your Knowledge in SCN Topic Spaces

laszloszijarto
Explorer
0 Kudos

Thank you again, Ludek; I truly appreciate all your help.

Former Member
0 Kudos

Here is what I have done to prevent UI locking, although I am still having issues killing the background thread.

  1. User clicks on report, create new DocumentWindow, add new ReportViewer to DocumentWindow
  2. On separate thread create new ReportDocument,  load report, login, set table locations (sub/report). 
  3. Create indeterminate progress bar to show "Report Loading".  Add to ReportViewer control, center.
  4. Return ReportDocument to main form,  ReadRecords() before setting ReportViewer.ReportSource so that UI does not freeze.  The UI is responsive because nothing on the UI has changed yet.
  5. Bind ReportDocument to ReportViewer using Invoke/Callback (control was not created by main thread and cannot be modified directly).  ReportViewer fills/loads instantly.

Unfortunately, if the user closes the DocumentWindow, the ReportDocument.ReadRecords continues in the background even though you don't see it.  I haven't had any success killing this thread...

Former Member
0 Kudos

Hello Brendan

Those are great tips and many thanks for sharing those.

I think the last part ( ReportDocument.ReadRecords continues in the background) is going to be difficult / impossible(?), as CR uses asynchronous connection to the database. E.g.; the query is handed off and the report engine essentially forgets about is until the data is sent back from the server. I can't come up with any ideas on how to kill asynch connections...

- Ludek

Former Member
0 Kudos

Thanks Ludek.  Aside from what I noted, is there any other way of keeping the UI responsive on a long loading report?

How does it work in the Crystal Reports program, in that you can stop or close a report at anytime, and the UI is still responsive? 

Is there any way of getting data off in pages/chunks?  Maybe with the In process RAS or something else?

Former Member
0 Kudos

Hello Brendan

You are asking such great questions. And I have no answers. But let me go to the horse's mouth (Program Manager) one more time and ask again. Sometime when the horse has had his wheaties just right, you get better / different answers LOL

- Ludek

Former Member
0 Kudos

Thanks Ludek. 

As an aside I have been using the reporting tools since the DataAccess-WinQL days and remember seeing you on the Crystal forums for a long time.  It's good to know people with your experience are available to provide assistance.  Time sure has flown by since Crystal (Vancouver)  > Seagate > Business Objects > SAP.  🙂

daniel-marschall
Newcomer
0 Kudos
I am trying to migrate from CRW XI (Delphi) to CRW 13 (C#), and I am very sad that there is no possibility to abort the loading of a report. It happens very often that a user has set a too broad filter and therefore the report would load for several minutes. I REALLY need a possibility to abort the loading. It was there in 2005 in CRW XI for Delphi but missing in .NET, and is still missing in 2025. Isn't there any possibility that this gets added, please?

Answers (0)