CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Preparing threaded reports

Questions & Answers about IWCGJQuery Suite.

by PdMagic » 27 Sep 2016 05:13

Hello,
I'm preparing to develop a new app, or rather rewrite and existing IW app using cgdevtools.
My app provides reporting of large databases. The reports can take time to run. Some 10-30 seconds, others a couple of minutes. In my current app, the user waits for page until the report is done rendering. (the report is built with IW controls and embedded raster, svg, silverlight and other content) This wait is unacceptable. I'm looking for a solution, in the form of a framework or just a pattern I can use to cause the rendering to occur in the background while the form loads. Then, the new form would display and a progress box would show the wait time until the report is complete.
Does your library contain anything that can help me in this regard? Do you have any other suggestions that will work with your tools?
My alternative will probalby be to launch a thread that does the heavy lifting of creating the report content, then repeatedly checking for completion and refreshing/loading this content when it is complete. I'd just prefer not to roll that sort of system if it already exists.
Please don't hesitate to be technical in your response. I'm a very capable programmer and am experienced in the tools I'll be using for this project. (JS, IW and Delphi)
PdMagic
 
Posts: 9
Joined: 27 Sep 2016 04:39

by assapan » 27 Sep 2016 06:52

Hi,
Have you had a look to TTask.Run and TTask.future in latest delphi , it allows to easily run a heavy task without locking front application so you can display anything you want like progressbar and so on.
Want to visit Ardeche http://leclosdelarc.fr/index.php
The Pont d’Arc Cavern http://en.cavernedupontdarc.fr
Image
User avatar
assapan
 
Posts: 600
Joined: 16 Dec 2013 12:04
Location: France

by Jorge Sousa » 27 Sep 2016 15:26

Hello PdMagic

Please take a look at

http://www.cgdevtools.com/demo/JQueryDemoV3_IW14_ISAPI.dll/?frame=EasyProgress

in the JQueryDemo_V3 source code
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by PdMagic » 27 Sep 2016 15:58

Hi Jorge,
So that progress control... How would I integrate that into the reporting app I am describing?

I've displayed a form and click a button to start the report generating. Do I begin updating the IW form in a thread? Does the server code need to return right away for the progress to begin? Or, is the progress client-side and starts with the button click?
That control looks like the simple solution for what I'm trying to accomplish - displaying progress while the server works.
The next better solution would be a framework that somehow lets me prepare the report in the background while my app runs and responds to requests, then makes the report available when it is complete. This is not simply a control, but some system for managing the output before it is displayed.
Thanks!
Pete
PdMagic
 
Posts: 9
Joined: 27 Sep 2016 04:39

by zsleo » 27 Sep 2016 20:18

Pete
The progress status while running long reports and other threaded interfaces (like threaded interaction with third party sites) is an issue I have been trying to resolve for some time - without success.

I have resorted to using the lockindicator with the button onclick event. Not ideal but it does at least provide the user with an easy to understand "something is running, please wait" interface
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by assapan » 27 Sep 2016 20:34

Hi,
here is how i solved the problem of external process

First i run the process using a TTask.future ( Introduced in XE5 i think)
Code: Select all
      IntegerFuture := TTask.Future<Integer>(
        function: Integer
        begin
          Result := Ticket.FinalizeEx(Integer(Data) - 1, Round(V * 100));
        end);


then i create a frame with a "In process" progressbar , future is passed as parameter (IntegerFuture)
Code: Select all
 
   TFrameProcessEncaissement.Go(WebApplication, OnProcessEncaissementTerminate, 'Patientez..', IntegerFuture);


this frame as a timer which try to read the Future result and close the frame if terminated
Code: Select all
procedure TFrameProcessEncaissement.TimerProcessAsyncTimer(Sender: TObject; EventParams: TStringList);
begin
  TimerProcess.Enabled := False;

  if Future.Wait(10) then
  begin
    if Assigned(FOnTerminate) then
      FOnTerminate(Self, Future.Value, Nil);
    Closedialog;
  end
  else
  begin
    TimerProcess.Enabled := true;
  end;

end;
Want to visit Ardeche http://leclosdelarc.fr/index.php
The Pont d’Arc Cavern http://en.cavernedupontdarc.fr
Image
User avatar
assapan
 
Posts: 600
Joined: 16 Dec 2013 12:04
Location: France

by Jorge Sousa » 28 Sep 2016 09:27

Hello PdMagic

As Assapan described, you can have parallel processing of the report or another long duration task, BUT, you always need a TIWTimer to update the controls, or even give the user the opportunity to cancel the process.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to Q & A

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.