Solved

Managing *.dbf tables II?

Posted on 2001-08-06
8
185 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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 200 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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