[HELP]Transfer many records to another table

xina_manxina_man Member Posts: 116
Hi there!

I want to transfer data from a table into the same table but with some diferent data.
I'm usisg the code below, but it only copies the first record. The Rec.COUNT Function return the value 3, so I dont know wat am I doing wrong...
Can anyone help me???
Rec.FIND('-');
REPEAT
   Rec."Worksheet Template Name":='NEC.';
   Rec.Requisitante:=USERID;
   Rec."Shortcut Dimension 1 Code":='901';
   ReqLineTable.TRANSFERFIELDS(Rec);
   ReqLineTable.INSERT(TRUE);
UNTIL Rec.NEXT=0;

Thanks in advance

Answers

  • krikikriki Member, Moderator Posts: 9,110
    Rec.FINDSET;
    REPEAT
       ReqLineTable.TRANSFERFIELDS(Rec);
       ReqLineTable."Worksheet Template Name":='NEC.';
       ReqLineTable.Requisitante:=USERID;
       ReqLineTable."Shortcut Dimension 1 Code":='901';
       ReqLineTable.INSERT(TRUE);
    UNTIL Rec.NEXT=0;
    

    The FINDSET will read the data somewhat faster then FIND('-') on SQL.
    The error was that you changed "rec" and then transferred it to the other record. After that, the NEXT command didn't find any record anymore. Now I FIRST transfer "rec" to another variable and then I change it and INSERT it.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.