Tuesday, March 15, 2016

X++ Deal with a table buffer as a variable (part2)

Refer to MSDN page Table as data type

We can also write or refer to a field as a variable like as below code.


public void printCust()
{
    int i, n, k;
    CustTable custTable;
    DictTable dictTable;
    ;
 
    dictTable = new DictTable(custTable.TableId);
    n = dictTable.fieldCnt();
 
    print "Number of fields in table: ", n;
    for(i=1; i<=n; i++)
    {
        k = dictTable.fieldCnt2Id(i);
        print "The ", dictTable.fieldName(k), 
            " field with Id=",k, " contains '", 
            custTable.(k), "'";
        pause;
    }
}



No comments:

Post a Comment