Primary Index
A primary key is one or more columns that uniquely identify one record in a
table from all the other records.
A primary index is a unique index for a table that defines the primary key for that
table. To set an index as a unique index, set the index property Allow Duplicates
to No.
To set the primary index on a table, open the property sheet for the table. The
PrimaryIndex property allows any unique index with a key that is mandatory and
cannot be edited.
Surrogate Key
When a primary index is not specified, Microsoft Dynamics AX 2012 uses a Surrogate
Key as the primary index. This key is the RecId field and, if the table is saved per
company, the DataAreaId. The surrogate key is used on many relations between
tables.
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
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
X++ Attributes In Ax2012
X++ Attributes
MDAX-2012 supports attributes being assigned to X++ code. This allows for a rich set of metadata to be built. It describes methods and types that are defined within X++ code. Attributes are defined as classes that are derived from the SysAttribute class. The following code for the SampleAttribute class is an example of an attribute class:
public class SampleAttribute extends SysAttribute
{
str sMetadata; // A field in classDeclaration.
public str GetMetadata()
{
return sMetadata;
}
public void new(str _sMetadata)
{
super();
sMetadata = _sMetadata;
}
}
Attributes can then be used on other classes and methods. The following example shows the structure of a new Attribute class, AuthorAttribute:
class AuthorAttribute extends SysAttribute
{
str author;
public str Author()
{
return author;
}
public void new(str _author)
{
super();
author = _author;
}
}
In the following example, AuthorAttribute is used to decorate other classes and methods:
[AuthorAttribute("Isaac")]
public class MyClass()
{
...
}
[AuthorAttribute("Isaac")]
void MyMethod()
{
...
}
MDAX-2012 supports attributes being assigned to X++ code. This allows for a rich set of metadata to be built. It describes methods and types that are defined within X++ code. Attributes are defined as classes that are derived from the SysAttribute class. The following code for the SampleAttribute class is an example of an attribute class:
public class SampleAttribute extends SysAttribute
{
str sMetadata; // A field in classDeclaration.
public str GetMetadata()
{
return sMetadata;
}
public void new(str _sMetadata)
{
super();
sMetadata = _sMetadata;
}
}
Attributes can then be used on other classes and methods. The following example shows the structure of a new Attribute class, AuthorAttribute:
class AuthorAttribute extends SysAttribute
{
str author;
public str Author()
{
return author;
}
public void new(str _author)
{
super();
author = _author;
}
}
In the following example, AuthorAttribute is used to decorate other classes and methods:
[AuthorAttribute("Isaac")]
public class MyClass()
{
...
}
[AuthorAttribute("Isaac")]
void MyMethod()
{
...
}
FactBoxes In Ax2012
FactBoxes
A FactBox is a small selection of data related to the current record in the list page.
Three types of Factbox exist:
• Info part: This has its own data source and a number of controls. It is limited in what can be displayed. However it is simple and quick to create, and can also be displayed in the Enterprise Portal.
• Form part: This is a link to a form. The form can have the same controls as a standard form. However since this is displayed in the FactBox section of the list page, adding too many controls can crowd the part.
• Cues: This is a count of a number of records related to the current record in the list page. For example, it might show the number of outstanding invoices for a customer.
A FactBox is a small selection of data related to the current record in the list page.
Three types of Factbox exist:
• Info part: This has its own data source and a number of controls. It is limited in what can be displayed. However it is simple and quick to create, and can also be displayed in the Enterprise Portal.
• Form part: This is a link to a form. The form can have the same controls as a standard form. However since this is displayed in the FactBox section of the list page, adding too many controls can crowd the part.
• Cues: This is a count of a number of records related to the current record in the list page. For example, it might show the number of outstanding invoices for a customer.
Form Templates In AX2012
Form Templates
Some form templates are available to help create the correct form type with the
appropriate controls, and to keep the design consistent across the application. The
following table shows the available form templates and where they should be
used.

Examples of Templates
The following table gives examples of each form template

To create a form using a template, right-click the Forms node in the AOT, select New Form From Template, and then select the template. Try to create each template and examine the controls and design that is created.
Examples of Templates
The following table gives examples of each form template
To create a form using a template, right-click the Forms node in the AOT, select New Form From Template, and then select the template. Try to create each template and examine the controls and design that is created.
Table Relations (Normal , Related Field Fixed , Field Fixed)
Table Relations (Normal , Related Field Fixed , Field Fixed)
Lets say you have ClothesTable and ClothesOrders.
ClothesTable has the following fields: ClotheId, Name and CollectionTypeId
ClothesOrder has the following fields: OrderId, ClotheId, Qty OrderId could be a number sequence and Qty entered manually bby the user.
CollectionTypeId has the following elements:
0 - Men
1 - Women
2 - Children
Example 1: Related Fixed FieldOn MenClothesOrder we create a new relation to ClothesTable and specify the follwing two:
1. Normal = ClotheId to ClotheId (Best practice to specify this on the EDT) and
2. Related Fixed Field 0 = ClothesTable.CollecTionTypeId.
This shows that the lookup to the clothes table should show only clothes with the same ClotheId (point 1) AND clothes that are of type Men (point 2) because the our table deals with order for mens' clothes. We use 0 because Menis element 0 in the Enum.
Example 2: Fixed Field This kinda works the other way round:
Imagine you have a ClothesOrders table (generic) and you have seperate tables for MenClothesTable, WomenClothesTable and ChildrenClothesTable. Fixed field says that the specified normal relation (on ClotheId) to MenClothesTable only works if the CollectionTypeId of the current record is set to 0 (Men) else the relation is disabled.
Lets say you have ClothesTable and ClothesOrders.
ClothesTable has the following fields: ClotheId, Name and CollectionTypeId
ClothesOrder has the following fields: OrderId, ClotheId, Qty OrderId could be a number sequence and Qty entered manually bby the user.
CollectionTypeId has the following elements:
0 - Men
1 - Women
2 - Children
Example 1: Related Fixed FieldOn MenClothesOrder we create a new relation to ClothesTable and specify the follwing two:
1. Normal = ClotheId to ClotheId (Best practice to specify this on the EDT) and
2. Related Fixed Field 0 = ClothesTable.CollecTionTypeId.
This shows that the lookup to the clothes table should show only clothes with the same ClotheId (point 1) AND clothes that are of type Men (point 2) because the our table deals with order for mens' clothes. We use 0 because Menis element 0 in the Enum.
Example 2: Fixed Field This kinda works the other way round:
Imagine you have a ClothesOrders table (generic) and you have seperate tables for MenClothesTable, WomenClothesTable and ChildrenClothesTable. Fixed field says that the specified normal relation (on ClotheId) to MenClothesTable only works if the CollectionTypeId of the current record is set to 0 (Men) else the relation is disabled.
Thursday, August 30, 2012
What is a Model and how to create them?
Models
A model is a logical grouping of elements within a layer.
Models help in situations where multiple ISV solutions or projects must operate together.
This architecture allows many solutions to co-exist within each layer.
An element can exist in exactly one model in a layer. The same element can exist in a customized version in a model in a higher layer.
New models are easy to create in the MorphX IDE and are applied when modifying or adding objects in the AOT.
Models can be exported, installed, or uninstalled from the model store.
Models are identified by a name and a publisher, and have a set of properties that can be changed, including a version number.
How to create a new Model:
Tools > Model management > Create model.
A model is a logical grouping of elements within a layer.
Models help in situations where multiple ISV solutions or projects must operate together.
This architecture allows many solutions to co-exist within each layer.
An element can exist in exactly one model in a layer. The same element can exist in a customized version in a model in a higher layer.
New models are easy to create in the MorphX IDE and are applied when modifying or adding objects in the AOT.
Models can be exported, installed, or uninstalled from the model store.
Models are identified by a name and a publisher, and have a set of properties that can be changed, including a version number.
How to create a new Model:
Tools > Model management > Create model.
Subscribe to:
Posts (Atom)
