Solved

Managing *.dbf tables II?

Posted on 2001-08-06
8
183 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
Comment Utility
I could, but not for 50 points  ; )
0
 

Author Comment

by:blash
Comment Utility
OK
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
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
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
and yodamage, now 150pts (100 blash, 50 mine)
enough?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:blash
Comment Utility
Hi guys,

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

Blash
0
 
LVL 1

Accepted Solution

by:
ntony earned 200 total points
Comment Utility
// 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now