Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Managing *.dbf tables II?

Posted on 2001-08-06
8
Medium Priority
?
191 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
[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
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
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!

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

688 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