Friday, August 31, 2012

Tables Vs Classes In Ax2012

Tables as Classes
A table can be considered an independent class used to address fields or methods defined on that table. In fact when a table is instantiated, it is done so with the system class called xRecord. This class contains methods called when committing record changes to the database and some other system methods that operate on records.
Differences between tables and classes include the following:
• A place for a table buffer is automatically assigned in a table (in classes the new method is used).
• Fields in tables are public; they can be referred to from everywhere.
• Fields in tables can be referred to directly; for example, in a report, whereas variables in a method can only be referred to using accessor methods.
Table Code
The following example illustrates how table code differs from code for a class.
str text;
text = CustTable.name; // Fields in a table are public
print CustTable.name; // Fields in a table can be referred to directly

No comments: