Saturday, 22 November 2014

Difference between New() and Construct()

Construct:
This method returns an instance of a class, it is a best practice to have a construct method in your class.

This method should be static but can be private or private depending on case, when calling a class from another class or job construct method can be use for this.

New:
This method is default constructor of a class, Invokes when user uses a "new" keyword.

Mostly it is protected.


Base Enumeration


  • These are predefined text values for a field that are referenced through an integer in the database.

Table group in Ax2012.


  • Table group provide a method for categorizing tables according to the type of the data they contain.
  • When exporting data you can use tables groups to filter the records.
  • Some of the tables groups are Parameters, Group, Main, Transactions, WorksheetHeader, worksheetLine, Miscellaneous. 


Index and Index hint in Ax2012

Index:
When we index in select statement it implies that the declare index field should behave as an order by and is optional the database to use. database can use its own preferences.

Index Hint:
Index hint in select statement will force the database to choose index for fetching data whether it is correct or not.


Maps in AX

  • Map is a logical collection of almost identical table.
  • A map is a compensation for the fact that tables cannot inherit properties from one to another.
  • A map can unify the access to similar columns and methods that are present in multiple tables. This enables you to use the same field name to access fields with different name in different tables.

Relations in Table in Ax2012

Relations between tables are used to associate rows in one table to rows in another table.

Relations are used to
  1. Enforce business rules across tables.
  2. Create auto joins in forms.
  3. Validate data by providing constraints.
  4. Look up values in other table.
  5. Generating field help.

Delete action in Ax2012

There are four delete actions:

  1. None: A None delete action will delete selected row in a table but nothing occurs to the table that relate to this table.
  2. Cascade: A Cascade delete action will delete all the records in the related table, i.e, deleting the parent record will also delete child record in the related table.
  3. Restricted: A Restricting delete will raise an error message if the user tries to delete a record, where records exists in related table where the foreign key is equivalent to the primary key of the current table.
  4. Cascade + Restricted: The delete action performs an restricted, if the record of the table will  be deleted directly and performs an cascade, if the record of the table will be deleted through a cascade delete action of a database.

Index in Ax2012

Indexes in database are used to locate records, They are stored separately in the database and contains a key that can be quickly located in the index and the reference to the record.

There are two types of index;
  1. Unique
  2. Non- Unique
In a unique key it ensures that no duplicate value occurs in the column.

Non-Unique key provide quick o retrieving data, instead of performing full table search of all the records in a table.

Primary Index:
A primary index is a unique index for a table that defines the primary key for that table.

To set the index as unique index, set the property Allow duplicate to 'NO'.

Clustered Index:
It is a physical order in which the records are stored in a table. 

In clustered index on a text field called "Name" and you insert a record with a letter 'D', the record will physically be inserted between C and E record.

Clustered index do not have to be unique.

Surrogate key;
When a primary index is not specified, Ax uses a surrogate key as primary index

The RecId is the key that is used as surrogate key

The surrogate key is used on many relations between tables.


Extended Data Type (EDT) in Ax2012

  • EDT is user defined definition of a primitive datatype.
  • EDT extends primitive datatypes or other EDT's.
  • The benefit of creating EDT is reuse of their properties, Another benefit is more efficient maintenance.  

Create Extended Data Type:

You can create an extended data type in the Application Object Tree (AOT), and then base a table field on this type.
  1. In the AOT, click Data Dictionary.
  2. Right-click Extended Data Types, click New, and then click a data type to base the extended data type on.
  3. Right-click the extended data type you created in step 2, and then click Properties.
  4. To base the extended data type on another extended data type, select an extended data type from the Extends property list.
  5. The list of available extended data types varies, depending on the base data type that you selected in step 2.
  6. Modify additional properties, as needed.
Press CTRL+S to save the extended data type.