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
Solved

Managing *.dbf tables II?

Posted on 2001-08-06
8
186 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 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