Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Table Field Cycling.

0 views
Skip to first unread message

Dwayne

unread,
Apr 20, 2007, 2:10:25 PM4/20/07
to
Since BatchMove is failing miserably on my large file, I am going to have
to transfer my data one record at a time.

My question is this:

Is there a way to cycle through all the different fields in a record?

for example (Psuedo code here ).

Table1
Table2
while(!Table1->Eof)
{
c=Table1->FieldCount.
while(c>=1)
{
Table2.Field(c)=Table1.Field(c);
c++;
}
Table2->Post();
Table1->Next();
}


Thanks

Dwayne


Jayme Jeffman

unread,
Apr 25, 2007, 2:27:16 PM4/25/07
to
Hello,

What database are you using ? Oracle ?
If so there is a solution through a SQL command.

Jayme.


"Dwayne" <myfri...@yahoo.com> escreveu na mensagem
news:462901d9$1...@newsgroups.borland.com...

Dwayne

unread,
Apr 26, 2007, 5:40:13 PM4/26/07
to
Hello Jayme,

I am using Borland Builder 5 and Dbase for my files.

Dwayne


Jayme Jeffman

unread,
May 11, 2007, 11:51:07 AM5/11/07
to
I am very sorry. The solution trhough SQL uses a
non ANSI syntax.

Jayme.

"Dwayne" <myfri...@yahoo.com> escreveu na mensagem

news:46311c34$1...@newsgroups.borland.com...

Jayme Jeffman

unread,
May 14, 2007, 8:30:17 AM5/14/07
to
Have a look at "TBatchMove" in the C++Builder Help file.

HTH

Jayme.

"Dwayne" <myfri...@yahoo.com> escreveu na mensagem

news:46311c34$1...@newsgroups.borland.com...

Antonio Felix

unread,
May 14, 2007, 5:29:15 PM5/14/07
to
> Have a look at "TBatchMove" in the C++Builder Help file.

Hi Jayme

That's the reaon for the question

<Quote>


Since BatchMove is failing miserably on my large file, I am going to have
to transfer my data one record at a time.

</Quote>

;-)


Antonio Felix

unread,
May 14, 2007, 5:37:49 PM5/14/07
to
> for example (Psuedo code here ).
>
> Table1
> Table2
> while(!Table1->Eof)
> {
> c=Table1->FieldCount.
> while(c>=1)
> {
> Table2.Field(c)=Table1.Field(c);
> c++;
> }
> Table2->Post();
> Table1->Next();
> }
>

I don't know if you've already solved your problem ?

Assuming the tables share the same structure you will be able to use the
pseudo code above.

something like (untested)

for ( int i = 0; i < Table1->FieldCount; i++ )
Table2->Fields->Fields[i] ->Assign(Table1->Fields->Fields[i]);

inside the table looping / Posting

HTH
Antonio


Jayme Jeffman

unread,
May 17, 2007, 10:28:20 AM5/17/07
to
I'm sorry.
:-|

Jayme.

"Antonio Felix" <antoni...@maisspamnao.clixempt> escreveu na mensagem
news:4648d455$1...@newsgroups.borland.com...

Dwayne

unread,
May 21, 2007, 4:10:55 PM5/21/07
to
I don't know if you've already solved your problem ?

Assuming the tables share the same structure you will be able to use the
pseudo code above.

something like (untested)

for ( int i = 0; i < Table1->FieldCount; i++ )
Table2->Fields->Fields[i] ->Assign(Table1->Fields->Fields[i]);

inside the table looping / Posting

Hello Antonio!

Long time no see!.. It is great to see and hear from you...

No, I have not solved my problem yet... I will attempt your way of doing
it.
I have used the Batch method for years, but I think it is limited on file
size, or Record numbers. it stopped working on me. So, I was working on
figuring a run-around way to solve my problem.

I have company records back to 1996, and they want to keep them... Right
now, I split up the files using Dbase (manually) and shrunk the later data
to make it work.

Dwayne


Antonio Felix

unread,
May 22, 2007, 9:16:15 AM5/22/07
to

>
> Long time no see!.. It is great to see and hear from you...
>

Same here.
Tell me if you need further help...

BR
Antonbio

Jayme Jeffman

unread,
May 22, 2007, 3:31:07 PM5/22/07
to
Hello Dwayne,

I know you've been facing problems on using
the "Batch" method.
Have you considered using the TBatchMove
component instead of a TTable ?

This component has two datasets. One is the
TBatchMove::Destination, which must be a
TTable, the other is the TBatchMove::Source,
which can be also a TTable or a TQuery
because both are TBDEDataSet descendents .

Using a TQuery you can limit the number of
records and divide the amount of data to
transfer through the TBatchMove component.

Why don't you give it a try ? I've never used
them to handle so many records, so I'm not
an expert on this matter.

HTH.

Jayme.

"Dwayne" <myfri...@yahoo.com> escreveu na mensagem

news:4651fccd$1...@newsgroups.borland.com...

Dwayne

unread,
May 29, 2007, 3:07:06 PM5/29/07
to
Ok, this is what I got, And it seems to work to some degree. But with
not all records. This table has been packed, so there are no "deleted"
records. They are all good.

But.. I think what is happening, is the Index is messing up everything.

Sometimes it transfers everything, sometimes nothing. This could be with
the index.

Dwayne

First button:
AnsiString Buf1;
int i;
Form1->Table2->TableName="c:/customer/customer.dbf";
Form1->Table2->IndexName="c:/customer/customer.ndx";
Form1->Table2->Active=true;
Form1->Table2->StoreDefs=true;
Form1->Table2->Active=false;

Form1->Table2->TableName="c:/customer/junkjunk.dbf";
Form1->Table2->CreateTable();
Form1->Table2->Active=true;

Second Button:

int i;
Table1->First();
while(!Table1->Eof)
{
Table2->Append();

for ( int i = 0; i < Table1->FieldCount; i++ )
Table2->Fields->Fields[i] ->Assign(Table1->Fields->Fields[i]);

Table2->Post();

Table1->Next();
Form1->DBGrid2->Repaint(); (Attempt to Repaint the Grid... it was
worthess).
}


Antonio Felix

unread,
May 29, 2007, 5:57:22 PM5/29/07
to
>
> First button:
> AnsiString Buf1;
> int i;
> Form1->Table2->TableName="c:/customer/customer.dbf";
> Form1->Table2->IndexName="c:/customer/customer.ndx";
> Form1->Table2->Active=true;
> Form1->Table2->StoreDefs=true;
> Form1->Table2->Active=false;
>
> Form1->Table2->TableName="c:/customer/junkjunk.dbf";
> Form1->Table2->CreateTable();
> Form1->Table2->Active=true;
>
> Second Button:
>
> int i;
> Table1->First();
> while(!Table1->Eof)
> {
> Table2->Append();
>
> for ( int i = 0; i < Table1->FieldCount; i++ )
> Table2->Fields->Fields[i] ->Assign(Table1->Fields->Fields[i]);
> Table2->Post();
>
> Table1->Next();
> Form1->DBGrid2->Repaint(); (Attempt to Repaint the Grid... it was
> worthess).
> }
>

Hi Dwayne,

Have you tried to copy the Tables without the Index and after that run a
Create Index statement on Table2 ?
It should be easier using the natural order of the table.

The DBGrid is linked to Table2?
Why are you refreshing te grid on each record post?
To see the Grid repaint try to call Application->ProcessMessages just before
the Repaint call!

HTH
Antonio

Dwayne

unread,
May 31, 2007, 10:37:07 AM5/31/07
to
Hello Antonio,

> Have you tried to copy the Tables without the Index and after that run a
> Create Index statement on Table2 ?
> It should be easier using the natural order of the table.

I have tried, but I have yet to be able to make an index work on a
create. They always seem to fail on the DBASE program.

I do feel that the problem is lying in this new create table. with an
index though.

> The DBGrid is linked to Table2?
> Why are you refreshing te grid on each record post?
> To see the Grid repaint try to call Application->ProcessMessages just
> before the Repaint call!

I was trying to eliminate all possibilities, and see exactly what was
going on. I am doing this on a smaller sample data, so that I may be able
to experiment with it. The one thing that is sounding scary, is the
"delay" time if this thing should work <smile>. I sure would hate to copy a
lot of records...<SMILE>.

Dwayne


0 new messages