Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Managing *.dbf tables II?

Posted on 2001-08-06
8
Medium Priority
?
193 Views
Last Modified: 2010-04-06
Hi guys,
I hope someone could help me with this.

I have a c.dbf table. This is a temporary table. Data gets posted to it all the time during the application works. Now, I need to create another database table ? ?d.dbf?. This one would not be a temporary, but the final table in the application. The c.dbf collects rows (records) during the day. The rows get appended in it as the user posts them (row by row). Now I need to create this d.dbf table. On a menu-click (at the end of the day) all data from c.dbf should be posted to d.dbf. But d.dbf should have 2 extra fields for each row, first a field where a True/False sign could be posted (which would say if or not data has been sent to some communication device) and a second field that would be a counter ? will generate a unique ascending number. So, at this menu-click event c.dbf should be emptied and all it?s data appended to d.dbf. Plus, d.dbf should get the True/False sign in it?s first extra field from the communication device (data sent or not sent). Can someone help me to write all this in code?

If this writing is not clear enough, please do tell me which part of the question should I rephrase.

Thanks, Blash
0
Comment
Question by:blash
8 Comments
 
LVL 4

Expert Comment

by:YodaMage
ID: 6360152
I could, but not for 50 points  ; )
0
 

Author Comment

by:blash
ID: 6362730
OK
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6362731
i will offer you additional 50 pts.,
if you solve this yodamage,
i could it do myself,
but have not the time for coding a working sample

meikl ;-)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 6363078
and yodamage, now 150pts (100 blash, 50 mine)
enough?
0
 

Author Comment

by:blash
ID: 6463238
Hi guys,

Red alert.
Please somebody answer.
A promotion or degradation is at stake

Blash
0
 
LVL 1

Accepted Solution

by:
ntony earned 600 total points
ID: 6489471
// here is a litle code that i wrote
// i haven't time for more
// !!!i use *.db

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBTables;

type
  TForm1 = class(TForm)
    Database1: TDatabase;
    Table1: TTable;
    Table2: TTable;
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormActivate(Sender: TObject);
var
   TableList:TStringList;
   index:integer;
begin
     TableList:=TStringList.Create;
     Database1.Session.GetTableNames(Database1.DatabaseName,'',true,false,TableList);
     Table2.DatabaseName:=Database1.DatabaseName;
     Table2.TableName:='d.db';
     try
     Table1.Open;
     except
           MessageDlg('Table doesn't exist',mtError,[mbOK],0);
           exit;
     end;
     if TableList.IndexOf('d.db')=-1 then begin
        for index:=0 to Table1.FieldCount-1 do  begin
            Table2.FieldDefs.Assign(Table1.FieldDefs);
        end;
        Table2.FieldDefs.Add('Boo',ftBoolean,0,False);
        Table2.FieldDefs.Add('Counter',ftString,20,False);
        Table2.CreateTable;
     end;
     Table2.Open;
     Table1.First;
     While not Table1.EOF do begin
           Table2.Append;
           For Index:=0 to Table1.FieldCount-1 do begin
               Table2.Fields[Index]:=Table1.Fields[Index];
           end;
           Table2.Fields[Index].AsBoolean:=True;
           Table2.Fields[Index+1].AsInteger:=123;
           Table1.Delete;
     end;
end;

end.
0
 

Author Comment

by:blash
ID: 6499320
Thanks ntony for your code. It seems good. I haven't time to implement it right now, at work they've changed my priorities. But we'll be in touch.
0
 

Author Comment

by:blash
ID: 6542163
My departments IT Manager had changed. The new one sais not to do any programming more. So not to keep you from waiting any more, you've earned your 200 points.
Thanks, Blash
0

Featured Post

Industry Leaders: 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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

926 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