?
Solved

How to attach progressbar to batchmove process

Posted on 2003-03-13
3
Medium Priority
?
243 Views
Last Modified: 2010-04-04
Sorry my bad English, maybe someone can help me..
here is my code.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, Grids, DBGrids, StdCtrls, Buttons, ExtCtrls, DB,
  DBTables, ITProgrB;

type
  TForm1 = class(TForm)
    DBGridiep: TDBGrid;
    StatusBar1: TStatusBar;
    DBGridizp: TDBGrid;
    BitBt2: TBitBtn;
    BitBtn1: TBitBtn;
    Panel1: TPanel;
    BitBtn3: TBitBtn;
    MultiProgressBar1: TMultiProgressBar;
    procedure BitBtn1Click(Sender: TObject);
   
   
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}


procedure TForm1.BitBtn1Click(Sender: TObject);
begin
begin
   with DM.Qiepsk do begin
     DM.Qiepsk.Active;
     end;


   with DM.BMiepsk do begin
     Mode := batAppend;
     Source := DM.Qiepsk;
     Destination := DM.Tiepsk;
     Execute;
     end;
     end;
  end;

end
0
Comment
Question by:Jurcix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:classmate
ID: 8129181
This can't be done without appropriate events, and to my knowledge, TBatchMove has no events at all...

You might write an appending loop for this by yourself, or perhaps investigate the possibility of creating a descendant component of TBatchMove with such an event. But this also might not be possible.

regards, classmate.
0
 
LVL 3

Expert Comment

by:ILE
ID: 8131412
THERE IS ONE SOLUTION

IF U COPY FORM QUERY1 (SOURCE TABLE)
DEFINE FIELDS FOR EVERY ROW
AND IN ONCHANGE EVENT ON SOME ROW DO WHATEVER U WONA DO TO
MAKE SOME CAIND OF PROGRES BAR


U NOW HOW TO DEFINE FIELDS AREN'T YOU?
IF U DONT NOU JUST ASK
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 8131984
hi,
have a similar older sample

using ttables

just use instead table1.recordcount
(table1 was the source, and your source
seems to be a query)
a variable, where you have stored the
count of to be moved records
(a simple
select count(*) from SameTablesAsTheQueryHave where SameConditionAsTheQueryHave
for example)

//copying a table to another alias
//set the recordcound of the tbatchmove
//to a stepvalue you want
//maybe CountOfToCopiedRecords/10
//will update 10 times the progessbar
procedure TForm1.Button1Click(Sender: TObject);
var Count : Integer;
begin
  table2.DatabaseName := ComboBox1.Text;
  Table2.TableName := Table1.TableName;
  try
    Table1.Open;
    Button1.Visible := False;
    Progressbar1.Visible := True;
    Label4.Visible := True;
    Label5.Visible := True;
    Table1.DisableControls;
    Count := 0;
    Application.ProcessMessages;
    While Not table1.EOF do
    begin
      BatchMove1.Execute;
      Count := Count + BatchMove1.MovedCount;
      Progressbar1.Position := Round((Table1.RecordCount/count)*100);
      label5.Caption := InttoStr(Count)+' of '+InttoStr(Table1.Recordcount)+' processed';
      Application.ProcessMessages;
      Table1.MoveBy(BatchMove1.RecordCount);
    end;
    Table1.Close;
    Table1.EnableControls;
    Panel3.Visible := False;
    Application.ProcessMessages;
    Showmessage('Filling was Successfull');
  except
    Showmessage('Cannot Open Table');
  end;
end;

hope thats it

meikl ;-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question