How to access field in a table using this field id

To do this you could use next construction:

myTable.( filednum( myTable, myField ) ) = “XXX”;

This is the same as

myTable.myField = “XXX”;

Example:

Field AccountNum from CustTable have id 1. Then statement CustTable.(1) = “4000” – will initialize field AccountNum with value “4000”.

You could also use this feature while working with record of type Common.

Example:

    Common      common;
    CustTable    custTable;
    ;
    select custTable where custTable.AccountNum == "4000";
    common = custTable;
    info( common.( fieldnum( custTable, Name ) ) );

The output of running this code will be the info log with a message “Light and Design”, Where “Light and Design” – name of the customer with id “4000”.