Change field values

StGroStGro Member Posts: 13
edited 2005-05-14 in Navision Attain
Hello,

I need to fill a temp. table with lots of fields gathered from a few tables.
I´m talking about 40 fields.
I guess my code will look like:
field1 := table1.field1;
field2 := table1.field2;
field3 := table1.field3;
field 4 := table2.field;
...

I bet there is no better way then typing a procedure like this?
I think of something like going through a loop and copying fields by their id, or even better: a function alá "copy all field from table2 to table1, skip not existing fields in table1"

Any suggestions?

Regards,
Steffen

Comments

  • kinekine Member Posts: 12,562
    StGro wrote:
    a function alá "copy all field from table2 to table1, skip not existing fields in table1"

    This do TransferFields, but it is based on fields Nos. and if you have same nos. in Table2 and Table3, the fields will be overwritten (and there will be problem if one field with no. XX will be Text in one table and decimal in another...)

    But in this case I think that "hardcoded" C/AL := lines will be best (clear code and easy extendable)...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,112
    From V3.60 you can use Record and Field-references.
    Attention : In V3.60 there is a bug with the field-reference to a decimal : the decimal will be rounded to 4 decimals. This is fixed in 3.70.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.