How do i copy TempTable from Actual Table?

yukonyukon Member Posts: 361
Hi Expert,

How to copy actual table to temptable (Same structure).

I wrote like that.

Declare TempCustomer Record (Temporary - Yes)
Declare Customer Record.

Wrote at OnForm - Trigger.

TempCustomer.RESET;
TempCustomer := Customer;
TempCustomer.INSERT;

Message('%1 %2', TempCustomer.COUNT,Customer.COUNT);

Result : TempCustomer.Count is 1.
Customer.COUNT is 68.

What wrong? I want to copy a whole records. Do i need to loop & insert?
Please explain to me.


Best Regards,
Yukon
Make Simple & Easy

Comments

  • reijermolenaarreijermolenaar Member Posts: 256
    Yep, loop and insert is the only way.
    Reijer Molenaar
    Object Manager
  • yukonyukon Member Posts: 361
    Hi reijermolenaar,
    Yep, loop and insert is the only way.


    Thx 4 your reply,
    Anybody know other way, please let me know.


    I don't want to loop.](*,)
    Make Simple & Easy
  • bbrownbbrown Member Posts: 3,268
    yukon wrote:
    Hi reijermolenaar,
    Yep, loop and insert is the only way.


    Thx 4 your reply,
    Anybody know other way, please let me know.


    I don't want to loop.](*,)

    Why not? You can't handle the records if you don't read them.
    There are no bugs - only undocumented features.
  • matttraxmatttrax Member Posts: 2,309
    Yeah, you have to read records individually. It's a RECORD because it refers to one record in the table. There are no Table variables or anything.

    Perhaps you could explain what you are trying to accomplish? Maybe a temp table isn't even necessary. Either way, 68 records isn't very much to loop through.
  • kapamaroukapamarou Member Posts: 1,152
    matttrax wrote:
    Yeah, you have to read records individually. It's a RECORD because it refers to one record in the table. There are no Table variables or anything.

    Perhaps you could explain what you are trying to accomplish? Maybe a temp table isn't even necessary. Either way, 68 records isn't very much to loop through.

    On the other hand 68000 records would be too much to load into a temporary variable and who knows what impact that would have.
    matttrax wrote:
    erhaps you could explain what you are trying to accomplish? Maybe a temp table isn't even necessary

    I think starting with the above sentence is the best way to go...
  • garakgarak Member Posts: 3,263
    For temp. Tables read this before:

    viewtopic.php?f=23&t=35382
    Do you make it right, it works too!
Sign In or Register to comment.