Blog

Name is Anant Dubey and the intent to create this blog is to discuss the problems and issues that developer face in the dynamics AX development and to share the new things that come up with the new version of AX.

Friday, 27 February 2015

Table Inheritance in ax 2012


1.       Yes, we can now inherit the tables as well which means less code writing and extending the capabilities of base table to be used in derived table.
2.    Two main properties to enable the table inheritance are:
· SupportInheritance
· Extends
3.    Need of Table Inheritance:
· When there is 1:n or n:n relationships between two tables
· When base table and derived table both carry different information about same item/object.
4.       Scenario: The organization has 50 data-cards and allocates it periodically to the employees travelling to customer place. The system need to capture the information of data-cards with their unique number in one table, details of purchase and vendor in second table, data about data-cards issued to employees in third table and data about damage/loss of data-cards in fourth table.
a.        DataCardTable
b.        DataCardPurchaseDetails
c.        DataCardIssueDetails
d.        DataCardDamageLoss.
5.       For table inheritance : The system field InstanceRelationTypeId has been added to the base table and its values refer to derived tables.
6.       Each value in the DataCardTable.RecId column must match a RecId value in one of the tables that derives from DataCardTable.
7.       If we want to enable inheritance we have to set SupportInheritnace to yes on Table, before adding fields to the table. On the base table. Now add InstanceRelationTypeId’ of type Int64. This property tells the system which field must store the table IDs.
8.       Now create a derived table i.e. dataissue details.
9.       In the properties window for derived table, set the “Extends” property to base table i.e. DataCardTable.
10.  

11.   Modification of the record in base table which has corresponding record in derived table would result in same modification of record in the derived table automatically.