COPY method and TRANSFERFIELDS method

MRQ
MRQ Member Posts: 73
hi

what is the the different between COPY method and TRANSFERFIELDS method

i know that TRANSFERFIELDS copies fields based on the Field No. property of the fields. For each field in Record (the destination), the contents of the field with the same Field No. in FromRecord (the source) will be copied, if such a field exists.

but i wont to know in which cases i use COPY and in which cases i use TRANSFERFIELDS ????

thank u

Comments

  • Urmas
    Urmas Member Posts: 76
    TransferFields work with different tables.
  • Administrator
    Administrator Member, Moderator, Administrator Posts: 2,507
    MRQ wrote:
    but i wont to know in which cases i use COPY and in which cases i use TRANSFERFIELDS ????
    I know you like the feature, to have text in a larger size, a lot, but may I ask to use it less often?
  • DenSter
    DenSter Member Posts: 8,307
    COPY only works if both record type variables are based on the same table. TRANSFERFIELDS will transfer field values from one type of record variable to another (but, as you said, only the ones with corresponding field numbers).
  • randrews
    randrews Member Posts: 135
    I create temporary table (TT).
    I have real table of the same subtype (RT)
    TT.COPY(RT)
    MESSAGE:= FORMAT(TT.COUNT)+' , ' + FORMAT(RT.COUNT);
    

    And I recive the message "0 , 269"
    Why COPY don't work?
  • Urmas
    Urmas Member Posts: 76
    randrews wrote:
    I create temporary table (TT).
    I have real table of the same subtype (RT)
    TT.COPY(RT)
    MESSAGE:= FORMAT(TT.COUNT)+' , ' + FORMAT(RT.COUNT);
    

    And I recive the message "0 , 269"
    Why COPY don't work?

    PLEASE read the manual

    Copy command does not copy the table (contents) it copies record variable (and record variable is also not a record itself)
  • toenne
    toenne Member Posts: 38
    randrews wrote:
    I create temporary table (TT).
    I have real table of the same subtype (RT)
    TT.COPY(RT)
    MESSAGE:= FORMAT(TT.COUNT)+' , ' + FORMAT(RT.COUNT);
    

    And I recive the message "0 , 269"
    Why COPY don't work?

    hi randrews,

    "copy" only copies the contents of one record to the other.
    copying the contents of a table to a tempory table has to be done with the use of a loop like
    if rt.find('-') then
      repeat
        tt.copy(rt);
        tt.insert;
      until rt.next = 0;
    
  • J
    J Member Posts: 10
    COPY
    This copies the records data plus all filters, marks etc.

    TRANSFERFIELDS
    Transfer field values for different tables based on their fieldnumber

    Assigning ItemRec2 := ItemRec
    Copies only field values (same record variable)

    Fastest when copying values from one record variable to another is the assignment method.

    \:D/
  • randrews
    randrews Member Posts: 135
    Urmas

    I read manual !
    Help (CSIDE reference):
    COPY (Record)
    Use this function to copy a record from a C/SIDE table
    

    Nothing about temporary tables.

    To tell the truth I don't need this function (in a half year of using C/AL).
    I copy through REPEAT, UNTIL in temporary table.
    I saw this topic, and deside try this method (with reading help).