Using TransferFields need to copy the SELECTED FIELDS data??

pskannaapskannaa Member Posts: 138
Hi,

I need to copy the records from 'Temp table' into 'my table' with particular fields only ??

Eg:

Temp Table: below fields are
"No." "Description" "Type" "Address" "Phone"
My Table:

"No." "Type" "Address"

I would like to copy the records from "Temp table"(fields only No,Type,Address) into "My table".

How can i use in "TransferFields" method..???

Suggestion Plz..
Thanks

Regards,
Psk

Comments

  • DenSterDenSter Member Posts: 8,304
    You can't, TRANSFERFIELDS transfers all fields. If you want only a few fields, you'll have to set those in individual lines of code. It's just 3 fields, so that should be an easy fix.
  • pskannaapskannaa Member Posts: 138
    Oh !!

    This is for eg. i hav mentioned few fields but actual my table having around 35 fields are there..

    so, in NAV no other option to copy like this....mhmmmm #-o !!!!
  • rsnavrsnav Member Posts: 5
    You could try the following:

    1.) Create a copy of your source table.
    2.) Delete the fields from the newly created table that you don't need in your "transferfields".
    3.) Make a "transferfields" from your source table to the newly created table.
    4.) Make a second "transferfields" from your newly created table to your destination table.
  • pskannaapskannaa Member Posts: 138
    Oh !!! we can do it indirectly ....Logic is fine. what is thought there could be option to select the particular fields like SQL !!!

    Thanks for Suggestion...

    Regards,

    Psk
  • rsnavrsnav Member Posts: 5
    Where is the difference between "Selecting particular fields in SQL" (i suppose you refer to the insert statement) and assigning every single field in NAV?

    Actually i can't see an advantage that you might have with SQL.
  • DaveTDaveT Member Posts: 1,039
    Hi,

    You can use TRANSFERFIELDS if there is less fields in the record you are transferring to BUT the field numbers (and type/length) must match.
    So from your example if "My Table" fields are 1,2,3 then if you number the field on the "Temp Table" the same i.e. "No." = 1, Type = 2.... then it will transfer correctly.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • DenSterDenSter Member Posts: 8,304
    rsnav wrote:
    You could try the following:

    1.) Create a copy of your source table.
    2.) Delete the fields from the newly created table that you don't need in your "transferfields".
    3.) Make a "transferfields" from your source table to the newly created table.
    4.) Make a second "transferfields" from your newly created table to your destination table.
    Well that would be the same as simply assigning the fields that you want, only instead of assigning individual fields, now you have to clear individual fields. Plus, if you need to update an existing record this won't work, because you'll be clearing those fields during the transferfields too.

    Don't try to make it any more complicated than it has to be. If you don't need all fields, then assign individual fields. So what if you have to write 35 statements, that takes just a few minutes. In fact it took you more time to write this post and read the replies than it would have taken to write 35 assignment statements.
Sign In or Register to comment.