Dynamics Ax 2012 Interview Questions
Dynamics Ax 2012 Interview Questions
Interview Questions:
1. Difference between following
condel :- Use condel to delete one or more items from a container.
confind :- Use confind to locate a sequence of items in a container.
conins :- Use conins to insert some items into a container.
conlen :- Use conlen to find out how many items there are in a container.
connull :- Use connull to explicitly dispose of the contents of a container.
conpeek :- Use conpeek to extract an item from a container, and to convert it into another data
type
conpoke :- Use conpoke to replace (poke) an item in a container.
2. Difference between edit and display method
Display Indicates that the method's return value is to be displayed on a form or a report.
The value cannot be altered in the form or report
Edit Indicates that the method's return type is to be used to provide information for a field that is
used in in a form. The value in the field can be edited.
3. Difference between perspectives and table collection
Perspectives can organize information for a report model in the Application Object Tree (AOT).
A perspective is a collection of tables. You use a report model to create reports.
Table collection is a collection of table, which sharing across all the virtual companies.
4. What are the 4 types of files we need to copy to the standard folder?
*.aod - application object data file
*.ahd - Application Online Help Data file
*.ald - Application Label data file.
*.add - Application Developer Documentation Data file
*.khd - Kernel Online Help Data
And other files are
*.ahi
- Application Online Help Index files
*.adi
- Application Developer Documentation Index files
*.ali
- Application Label Index files
*.alt
- Application Label Temporary file.
*.alc
- Application Label Cache file
*. aoi - Application Object Index file
*.khd - Kernel Online Help Data
*.khi
- Kernel Online Help Index files
5. Why we use virtual companies?
Virtual company accounts contain data in certain tables that are shared by any number of
company accounts. This allows users to post information in one company that will be available
to another company.
From which table u can get the user permissions stored in Ax?
AccessRightList table.
with new/removed records as well as updating existing ones. This will honour any existing
filters and sorting on the form.
executeQuery() is another useful one. It should be used if you have modified the query in your
code and need to refresh the form. It's like
research() except it takes query changes into account.
17. Define AOT
The Application Object Tree (AOT) is a tree view of all the application objects within Microsoft
Dynamics AX. The AOT contains everything you need to customize the look and functionality of
a Microsoft Dynamics AX application
18. Define AOS
The Microsoft Dynamics AX Object Server (AOS) is the second-tier application server in the
Microsoft Dynamics AX three-tier architecture.
The 3-tier environment is divided as follows:
First Tier Intelligent Client Second Tier AOS Third Tier Database Server
In a 3-tier solution the database runs on a server as the third tier; the AOS handles the business
logic in the second tier. The thin client is the first tier and handles the user interface and
necessary program logic.
19. Difference between temp table and container.
1. Data in containers are stored and retrieved sequentially, but a temporary table enables you to
define indexes to speed up data retrieval.
2. Containers provide slower data access if you are working with many records. However, if you
are working with only a few records, use a container.
3. Another important difference between temporary tables and containers is how they are used in
method calls. When you pass a temporary table into a method call, it is passed by reference.
Containers are passed by value. When a variable is passed by reference, only a pointer to the
object is passed into the method. When a variable is passed by value, a new copy of the variable
is passed into the method. If the computer has a limited amount of memory, it might start
swapping memory to disk, slowing down application execution. When you pass a variable into a
method, a temporary table may provide better performance than a container
20. .What is an EDT, Base Enum, how can we use array elements of an EDT?
EDT - To reuse its properties. The properties of many fields can change at one time by
changing the properties on the EDT. Relations can be assigned to an edt are known as Dynamic
relations.
EDT relations are Normal and Related field fixed.
Why not field fixed field fixed works on only between two tables 1- 1 relation. And Related
field fixed works on 1- many tables.so edt uses related field fixed.
BaseEnum - which is a list of literals. Enum values are represented internally as integers.
you can declare up to 251 (0 to 250) literals in a single enum type. To reference an enum in X++,
use the name of the enum, followed by the name of the literal, separated by two colons . ex NoYes::No.
21. Definition and use of Maps, how AddressMap (with methods) is used in standard AX?
Maps define X++ elements that wrap table objects at run time. With a map, you associate a map
field with a field in one or more tables. This enables you to use the same field name to access
fields with different names in different tables. Map methods enable to you to create or modify
methods that act on the map fields.
Address map that contains an Address field. The Address map field is used to access both the
Address field in the CustTable table and the ToAddress field in the CustVendTransportPointLine
table
22. What is the difference between Index and Index hint?
Adding the "index" statement to an Axapta select, it does NOT mean that this index will be used
by
the database. What it DOES mean is that Axapta will send an "order by" to the database. Adding
the "index hint" statement to an Axapta select, it DOES mean that this index will be used by the
database (and no other one).
23. How many types of data validation methods are written on table level?
validateField(),validateWrite(),validateDelete(),aosvalidateDelete(),aosvalidateInsert(),
aosvalidateRead(),aosvalidateUpdate().
24. How many types of relations are available in Axapta, Explain each of them.
Normal Relation: enforce referential integrity such as foreign keys. For displaying lookup on the
child table.
Field fixed: works as a trigger to verify that a relation is active, if an enum field in the table has a
specific value then the relation is active. It works on conditional relations and works on enum
type of data.
Ex- Dimension table
Related field fixed: works as a filter on the related table.it only shows records that match the
specified value for an enum field on the related table.
25. When the recid is generated, what is its utility?
when the record is entered in the table the recid is generated by the kernel.it is unique for each
table.
26. Difference between Primary & Cluster index.
Primary index: It works on unique indexes. The data should be unique and not null. Retrieve data
from the database.
Clustered Index: It works on unique and non unique indexes.retrieve data from the AOS.
The advantages of having a cluster index are as follows:
Search results are quicker when records are retrieved by the cluster index, especially if
records are retrieved sequentially along the index.
Other indexes that use fields that are a part of the cluster index might use less data
space.
Fewer files in the database; data is clustered in the same file as the clustering index. This
reduces the space used on the disk and in the cache.
The disadvantages of having a cluster index are as follows:
It takes longer to update records (but only when the fields in the clustering index are
changed).
More data space might be used for other indexes that use fields that are not part of the
cluster index if the clustering index is wider than approximately 20 characters).
27. How many kind of lookups can be made and how.
By using table relations
Using EDT relations.
Using morphx and using X++ code(Syslookup class).
28. How many types of Delete Actions are there in Standard Ax and define the use of each
None
Cascade
Restricted
Cascade+Restricted.
29. If any record is created in table I want to fetch the date & time stamp, how will you do that?
Application objects such as reports, tables, and methods can run on the application object server
(AOS) or the client. An object can also have the RunOn property value set to Called from.
Objects set to Called from can run from either the client or server, depending on where the
object is called from. This topic describes the RunOn property, tiers that class objects can run on,
and hints about using AOSRunMode.
Default value of RunOn for Classes Called from
MenuItems
Client
37.What is main class used in batch process OR which class will you inherit to make a batch job
RunBaseBatch class
38. How can we make a batch job occur at regular interval - Using RunbaseBatch
39. What is the main utility of classes in standard Ax - For business logic
40. Which class is called when we create a SO/PO.
SalesFormLetter and PurchFormLetter
41. What is the basic structure of a form
Methods,DataSources,Design.
42. Properties of a form datasource
Name, Table, Index, AllowCheck, AllowEdit, AllowCreate, AllowDelete, StartPosition,
JoinSource, LinkType.
43. validateWrite() method can be written in form datasource as well as table level, when should we
write it in form DS and when in table. Similar in case of write() method
when we want the validation at the table level means in every form where this table is uses, we
can write at the table level.
If we want validations at the particular form and it doesnt effect to the other forms where this
table was used, then we can use form level validations.
44. How can we call table level methods from form DS (similar methods)
By creating the variable to the table and with tablevariable.methodname()
45. What is the difference between form init() & DS init()
Form init(): init is activated immediately after new and creates the run-time image of the form.
DS init(): Creates a data source query based on the data source properties.
The form data source init method creates the query to fetch data from the database and sets up
links if the form is linked to another form.
46. When a form opens what are the sequential methods called.
Form init(), DataSource init(), Form run(), DataSource executeQuery(), canClose(), close().
47. Where is the best place to write code to perform filter in a form
FormDataSource - executeQuery() and call this method in the design field of the form.
48. What are the different types of menu items available, explain each of them
Display for Form
Output - for Report
Action - for classes.
49. Action type menu item is attached to a form but in the drop down the menu item is not
appearing, what could be the problem .
50. Difference between pass by reference and pass by value?
Pass By Reference:
In Pass by reference address of the variable is passed to a function. Whatever changes made to
the formal parameter will affect to the actual parameters
- Same memory location is used for both variables.(Formal and Actual)-
You can override the executeSection method for a report section to modify the layout of the
section and to modify how the section is printed. If you want to do something before a section is
printed, such as go to the next page, this can be coded in the executeSection method.
63. What are Queries, how do we use them
You can create a query to retrieve data by using the query classes.
64. what is Composite query?
A composite query uses another query as its data source. A composite query is similar to class
inheritance in X++ or C#. A composite query is a good design choice when one of the following
is true:
An existing query lacks only a range that you want to add. An existing query lacks only a method
override that you want to add.
65. What is the use of Parameter, Enum Type Parameter/Enum Parameter properties of
MenuItems?
Parameters: Specify the arguments that are passed to the object. Optional.
Enum TypeParameter and Enum Parameter: Choose an enumerated type as a parameter for the
Object, and then select an enum value as the EnumParameter property. Optional.
These properties are typically used when one form is used in several different situations. You can
change the behavior of the form, depending on the EnumParameter value. For example, the
PriceDiscGroup form is used by three different display menu items (PriceDiscGroup_*), which
each have a different EnumParameter value. In the form's init method, a switch construct
checks the value, and then the form is created accordingly.
66. Why do we provide Configuration key & Security Key?
Configuration key: Configuration keys allow administrators to enable or disable features in the
application for all users. Disabling features helps to minimize the attack surface against potential
attacks.
Configuration keys are applied to:
Tables
Fields
Indexes
Views
Menus
Menu items
Form controls,
Report controls
Enumerations
Security key: Security keys allow administrators to set security on a user group level.
Minimizing access on a user group level helps to reduce the attack surface against potential
attacks.
The main reasons to apply user-level security are to:
Allow users to do only their designated tasks.
Protect sensitive data in the database.
Prevent users from inadvertently breaking an application by changing code or objects on which
the application depends.
You need to apply a security key to:
Tables
Views
Menus
Menu items
Form controls
Report controls
67. Normally what do we attach in Output
- Forms
- Classes
ew
Reread(): Refreshes the database search defined by the query, specified by the
FormDataSource.init method.
73. On closing a form name the methods which are invoked
Close(), closed(), finalise().
74. How can we provide user level/user group level security - By using security keys.
75. What is Visual MorphXplorer, what do we do with that?(Reverse engineering tool has
replaced Visual
MorphXplorer)
76. What is the function of Application Hierarchy Tree?
Displays the current object's inheritance hierarchy.
The Application Hierarchy Tree enables you to view information about the parents and children
of application objects. For example, you can see all the classes that extend a particular class, or
see which data types a particular extended data type inherits from. It also enables you to view the
methods, fields, and indexes that are used by tables. Information is available for application and
system classes, tables, and data types.
To view information for a single application object
Right-click the object, and then select Add-Ins > Application Hierarchy Tree.
To view information for all application objects
Select Tools > Development tools > Application Hierarchy Tree.
You need to generate cross-references before you can use the Application Hierarchy Tree.
Tables are listed under the Common node in the Application Hierarchy Tree. All tables extend
the system table called Common. Classes are listed under the Object node.
77. If you want to monitor the database activity, where can you get that?
Administration>Reports>DataBase information
Administration>inquiries> DataBase information
Administration>Reports>Size of Company accounts
78. Where can we find the Label log and what is its utility?
Tools>DevelopmentTools>Label>Label log.
Use this form to view the history of labels within the system and re-create labels that have been
deleted.
View a record of all changes made to the label files.
Each label is described in terms of its identification (ID), language, status, label text, and
by whom and when it was modified. A label can also contain a description, which is displayed at
the bottom of the form.
General
Button
Recreate
Query
Validate
The RunBase class is a framework for classes that need a dialog for user interaction and that need
the dialog values to be saved per user.
RunBaseBatch: You can design your own batch job by extending the RunBaseBatch class. You
can also write code to schedule the batch to run. The batch runs on the Application Object Server
(AOS)
91. What is the difference between Insert and doinsert.
Insert(): To insert the records into the database. Secure any related transactions with tts.
Doinsert():These methods should only be used under strict control because they bypass the
following:
Any validations that have been set up.
Any code that was written in the insert, update, and delete methods.
92. What is the Runbase Stack?
93. Difference between sql and x++ statement-SELECT1.Table buffer on the FROM in x++ clause ,not the table as in SQL
2.ORDER BY clause precedes the WHERE clause
3.! for negation ,not NOT as in SQL
4.&& and || for logical operator ,not AND or OR as in SQL.
5.* and ? for like wildcards ,not % and _ as in SQL.
JOIN CLAUSE1.Join clause has no ON keyword in x++,use WHERE instead
2.Default JOIN direction is left .
3.there are no LEFT and RIGHT keyword for JOIN in x++
4.The FROM clause is optional when:
-No column is listed or
-Only one table is listed in the SELECT in x++
select * FROM CustTable;
select CustTable;
both are same.
OTHERS1.The WHILE SELECT statement provides an automatic cursor for return rows in x++
2.There is no HAVING keyword in x++
3.No null values are return in x++
94. What is cluster installation?
Admin - Setup - Cluster Configuration
Click System administration > Setup > System > Cluster configuration.
You can distribute the user load in Microsoft Dynamics AX across multiple instances of
Application Object Server (AOS) by creating a load balancing cluster.
95. Steps in creating number sequence?
Basic>Setup>NumberSequences> NumberSequences Create a new number sequence.
Classes>NumberSequenceReference>LoadModule.
AR>Setup>parameters - setup code.
Tables>CustParameters - create method starts with numRefEDT.
Form>FormRun - Create numberSequenceFormHandler method.
Form>FormDataSource - Override create method.
96. Any module you are good at.
AR,AP,Inventory,Production.
111.What is JumpRef()?
The user activates the Go to main table command from the shortcut menu on the control or by
pressing CTRL+ALT+F4. The super() call opens the main table that contains data for the field.
112. D.B Abstract and final class.
Abstract forces the class to be derive subclass and final stops the class not to be derive or
inheritance.
113. D.B ValidateWrite and write.
validateWrite(): Executed when a new or updated record is to be written. Determines whether
data is valid and ready to be written.
Write(): Executed when the user inserts a new record or updates an existing one. Calls the
FormDataSource.validateWrite method and manages the database write operation.
114. What is dialoge class.
A dialog in AX is a simple form with a standardized layout, created by using the Dialog system
class. Dialogs should allow users to enter some simple values.
Dialog Classes- DialogField, DialogGroup, DialogTabPage, DialogText, DialogWindow.
Dialog Methods addField,addGroup,addTabPage,run,pack,unpack,
115. Pack and Unpack method?
Use the pack-unpack pattern to save and/or store the state of an object, and then later
reinstantiate the same object.
Pack():create a pack method to read the state of the object and return it in a container suitable for
saving or transporting between tiers. Reading the state of the object implies collecting the value
of all its members. If the members are tables (records, cursors, temporary tables) or classes, it
must also be possible to read their state.
Returns the state of the object as a container.
Unpack():create an unpack method that takes the packed state and reinitializes an object with it.
Construct the object before creating an unpack method.
The unpack method takes the saved state of the object and reinitializes the object with it. It
reinitializes the object members according to the values in the container, taking the supplied
version number into account.
The method can return a Boolean that signals the result of the initialization process.
116. Architecture of MS dynamics AX.
Ax has the three tier architecture --- 1 . client
2. AOS
3.DataBase.
syp
Bound control associated with a field in an underlying table. Use bound controls to
display, enter, and update values from fields in the database.
Unbound control does not have a data source. Use unbound controls to display
pictures and static text.
gls
Fewer resources are used to hold the locks during the update process.
Records remain available for other processes to update if they have been selected from
the database but haven't yet been updated.
The disadvantage of using OCC is that the update can fail if another process updates the same
record. If the update fails, it must be retried. This can lead to a reduction in database
performance.
OCC makes it possible for other processes to update a record even after it has been fetched. You
can catch update conflicts by catching the UpdateConflict and UpdateConflictNotRecovered
exceptions.
125. What are transactions?
126. How to lock transactions?
127. What are macros?
Macros act as a container for defining variables used for frequent tasks. The purpose of
macros is to make statements easy to reuse. A macro cant be executed independently as a class.
An advantage macro is that the maintenance is done in only one place.
Three types of macros
Macro libraries is a standalone macro that contains a collection of local macros.
Standalone macros is created by using the macro node in the AOT.
Local macros - is declared with in a method.
128. What is the default link type property? - Delayed.
129. Default join in select statement (Queries) - innerJoin
130. Difference between validate write and validate field?
validateWrite(): Executed when a record is written to the database, before the data change is
committed in the database.
validateField():Executed when you leave a field in a record. For example, after entering changes
to a field on a grid control, you could click another field in that same record or on a different
record. Or you could click another control on that same form.
The super() method invokes field validation checks, as guided by the value of the Validate
property.
131. Do we have validate write and validate field in form level?
FormDataSource validateWrite()
FormDataSourceField - validate()
132. What are the methods required for posting a purchase order?
133. How to give null in select query?
Select table where table.field == ;
Yes - Indicates that attributes from the table are to be consolidated into the parent
dimension (star schema).
142. What are all the add- on tools you used in Dynamics AX (Its an indirect question for AIF)
143. Did you work with EP (Enterprise Portal & Workflow) how can you implement this features
into your projects?
The parameter system design pattern holds static setup information for the modules in a
company, such as information on the national currency, the posting method, and so on. There is
one instantiation of this pattern per module.
The parameter system should be set up as described in this topic. The parameter record is
automatically created by the system and has the following:
A parameter table
A parameter form
1.
2.
3.
4.
5.
6.
7.
8.
18. Why SSRS using temporary table, can we use normal table?
19. How many types we can develop SSRS reports?
20. What is Data provider class?
21. What is the best way to develop SSRS reports? (query or DP class)
22. Write a program to print the sum of amount for each accountnum from CustTrans?
23. Write a program to print the reverse of a given number?
24. Write a program for finding the biggest element in the array?
25. What are changes between Ax2009 and Ax2012?
26. What is table inheritance in Ax 2012?
27. What is table reference in EDT 2012?
28. What is surrogate key in Ax 2012 ?
29. How to cancel the sales order from X++, what is the best place to write the code for cancelation?
30. If I have millions of records in a form and to open the form or perform any operation it is taking
more time. So how to speed up the process of the form to retrieve the records from the database?
31. What is FIFO and LIFO in inventory ,give the real time example?
32. How to debug the batch jobs in ax?
33. What is amstrong number write a program for finding the amstrong number?
34. Where you will write the code for filter in form and report?
35. Differences between abstract class and interfaces?
1. Main difference is methods of a Java interface are implicitly abstract and cannot have
implementations. A Java abstract class can have instance methods that implements a default
behavior.
2. Variables declared in a Java interface is by default final. An abstract class may contain nonfinal variables.
3. Members of a Java interface are public by default. A Java abstract class can have the usual
flavors of class members like private, protected, etc..
4. Java interface should be implemented using keyword implements; A Java abstract class
should be extended using keyword extends.
5. An interface can extend another Java interface only, an abstract class can extend another
Java class and implement multiple Java interfaces.
6. A Java class can implement multiple interfaces but it can extend only one abstract class.
7. Interface is absolutely abstract and cannot be instantiated; A Java abstract class also cannot
be instantiated, but can be invoked if a main() exists.
8. In comparison with java abstract classes, java interfaces are slow as it requires extra
indirection.
Interview Questions:
1) Tell about your Self.
2) What kind of Customizations you have done.
3) How you will create Table in Ax. In that Table how you will define Indexes, Relations, Delete
Actions and Methods. Tell me the steps First what you will do, First you will define Indexes or
Relations. Why?
4) What is Naming Conventions in Ax?
5) What is Index? How many types of Indexes are there? What is unique index and non-unique?
6) What is Cluster Index?
7) What is Cache Look Up? More Questions on regarding Cache Look Up?
8) What is FormRef?
9) What is Configuration Key? Why need of configuration keys?
10) What is Security Key?
11) What is Record Level Security?
12) How the ax is providing security. What are the ways?
13) Types of Relations.
14) Types of Delete Actions.
15) What kind of methods you will create will create a Particular Table?
16) What is Table Collections?
17) How you will create different Environments like Aos1, Aos2..so on
18) For Example: 150 users are Accessing Aos1.How you will assign users to Aos2 for that what you
required. More Questions on regarding AOS
19) Tell me the Invent Table Form Data sources?
20) Invent Dim Table What it stores?
21) What is Table Group? When you creating new tables in ax by default what is the Table Group?
22) Can you tell me the Sales Table, Table Group? What it consists
23) How you will do the SSRS Repots in AX?
24) What are all the New Features are added in Ax 2009?
25) How to install Ax 2009? What it Require? How you will install in Win XP & Vista? More
Questions on regarding Ax Installation.
26) What is Workflow? How you will do this? Ex: For Po how to configure Workflow? Steps..
27) For New Module how to Achieve Workflow. Steps. more Questions on regarding WF
28) How you will configure Workflow For AR
29) How to install Workflow. What it requires (softwares).
30) Weather Workflow requires EP?
31) What is EP? What it requires (softwares). More Questions on regarding EP.
32) What is Number Sequence? How you will do that? Number Sequence Steps
33) How you configure Number Sequence in Ax? For Example I created one record in ABC Form. I
didnt save the record. I just deleted the record. In that Case what will happen? What comes
next.
34) What is Global Address Book?
35) How can you use the Global Address Book?
36) How can you Create New Employee?
37) What is the use of Virtual Companies?
38) At form Level how you will define Query Build Classes. How you will do that
39) Tell me Form Level Data Source Methods.
40) What is Execute Query
41) What is Init at form Methods
42) Types of Inventory Dimensions?
43) Types of Item Dimensions?
44) Types of Storage Dimensions?
45) Types of Dimensions in Ax?
46) How to define Composite Queries in Ax?
47) Number Sequence Classes.
48) Types of Link Types?
49) Inner Join and Exists Join?
50) Oops Concepts?
51) What is inheritance?
52) Types of Inheritance?
53) What is Abstract Class in Ax? How you will define?
54) What is interface?
55) Tell me Interfaces Classes in Ax?
56) What is RunBase?
57) Where we can create item in Ax2012?
58) Difference between change company and cross company?
59) What is surrogatekey in 2012?
60) How to import data one application to another application?
61) Differences in 2009 and 2012?
Hexaware Pune
1. What are the differences between Ax2009 and Ax2012?
2. Table method sequences? Validate write and write methods? Need of write method?
3. What is the mandatory property when creating the Table?
4. What is delete actions and what is Cascade+Restricted?
5. What is the return type of find method?
6. What is Primary index and Clustered index?
Infosys Chennai
1. What is the form methods sequence?
2. What is init() method in a form?
3. What are the report method sequences?
4. When you open a report, how many times call the fetch?
5. What is the execute method? How many times it calls?
6. What are the mandatory properties of a table?
7. What is intivalue() in a table and in a form?
8. what is cascade+Restricted? Differences among the delete actions?
9. What are the joins? Explain?
10. What are all the methods call when you save a record in a table?
11. What is polymorphism?
1) Difference between conpeek and confind
Confind :- we can find the position of an item.
static void conFindExample(Args _args)
{
container c = ["item1", "item2", "item3"];
int i;
int j;
;
i = conFind(c, "item2");
j = conFind(c, "item4");
print "Position of 'item2' in container is " + int2Str(i);
print "Position of 'item4' in container is " + int2Str(j);
pause;
}
Conpeek:- we can get the item in a particular position
static void conPeekExample(Args _arg)
{
container c;
int i;
;
c = conIns(["item1", "item2"], 1);
for (i = 1 ; i <= conLen(c) ; i++)
{
print conPeek(c, i);
}
pause;
}
2) Method overloading and Method overriding
X++ supports overriding, but it does not support overloading.
Overriding a Method [AX 2012]
The methods in a class are inherited by any class that extends it. You can alter the functionality of
an inherited method by creating a method in the subclass with the same name and parameters as
in the superclass. This is called overriding the method. For example:
// Superclass: Attribute
public class Attribute
{
int objectVariable;
}
void methodAtt()
{
//Some statements
}
// Subclass: ColorAttribute
public class ColorAttribute extends Attribute
{
int addedObjectVariable;
}
void methodAtt()
{
//Some statements
}
ColorAttribute is a subclass of Attribute and therefore inherits the method methodAttr. However,
because ColorAttribute defines a method with the same name and the same number of arguments, the
method in the superclass is overridden.
Preventing Method Overriding
Static methods cannot be overridden because they exist per class. To protect other sensitive methods, or
core methods, from being overridden, use thefinal modifier. In the example below, methodAtt is declared
as final, and so it cannot be overridden in any class that extends Attribute.
public class Attribute
{
int objectVariable;
}
final void methodAtt()
{
//Some statements
}
Note
Overloading is where there is more than one method with the same name, but the methods have different
signatures (return type or parameter lists or both).
Overriding is where the superclass's implementation of a method is altered by the subclass's
implementation of the method, but the signatures of both methods are the same.
3) DictTable and DictField Class
DictTable class is used to access information ralated to table. (if you want to access
the fields of a record, where you do not know the field names ex:- table_name.(field_id)
)
DictField class is used to access information ralated to table fields.
}
}
if (!dictField.isSystem())
{
value = custTable.(fieldId); // value of the record will display
if(value)
{
info(strFmt('%1 = %2',
dictField.label(), // field name will display
any2str(value)));
}
}
RecordSortedList: Allows you to insert multiple records in one database trip. Use the
RecordSortedList construct when you want a subset of data from a particular table, and when you want it
sorted in an order that does not currently exist as an index.
Student student;
RecordSortedList recordSortedList = new RecordSortedList(tablenum(Student));
recordSortedList .sortOrder(fieldname2id(tablenum(Student),StudentId));
student.clear();
student.StudentID=123;
student.FirstName=DOM;
student.LastName=FED;
recordSortedList.ins(student);
student.clear();
student.StudentID=456;
student.FirstName=TOM;
student.LastName=GED;
recordSortedList.ins(student);
student.clear();
student.StudentID=789;
student.FirstName=ROM;
student.LastName=TED;
recordSortedList.ins(student);
recordSortedList.insertDatabase();
RecordInsertList: Allows you to insert multiple records in one database trip. Use the
RecordInsertList construct when you do not need to sort the data.
insert_recordset: Allows you to copy multiple records from one or more tables directly into another
table on a single database trip.
update_recordset: Allows you to update multiple rows in a table on a single database trip.
delete_from Allows you to delete multiple records from the database on a single database trip.
6) Difference between update and doupdate
The doUpdate table method updates the current record with the contents of the buffer. This
method also updates the appropriate system fields.
The doUpdate method should be used when the update method on the table is to
be bypassed. Suppose you have overridden the update method of the table but sometime
there is a situation when you don't want the code written in the overridden update method
to be executed and at the same time want any selected record of that table to be updated.
In such situation you should call the table.doupdate() method instead of table.update()
method.
7) Collection Classes
you cannot store objects in arrays (x++ class) or containers. The Microsoft Dynamics AX
collection classes have been designed for storing objects.
Below are collection classes: Set , Map , List , Array (Collection class)
A Set is used for the storage and retrieval of data from a collection in which the members
are unique. The values of the members serve as the key according to which the data is
automatically ordered. Thus, it differs from a List collection class where the members are
placed into a specific position, and not ordered
automatically by their value.
static void Set(Args _args)
{
Set setOne;
Set setTwo;
SetEnumerator enumerator;
Int value;
setOne = new Set(types::Integer);
setOne.add(4);
setOne.add(6);
setOne.add(3);
enumerator = setOne.getEnumerator();
while (enumerator.moveNext())
{
value = enumerator.current();
info(strFmt("%1",value));
}
Output :- 3
4
6
A List object contains members that are accessed sequentially. Lists are structures that can
contain members of any X++ type. All the members in the same list must be of the same
type.
static void List(Args _args)
{
List integerList = new List(Types::Integer);
ListEnumerator enumerator;
// Add some elements to the list
integerList.addEnd(1);
integerList.addEnd(4);
integerList.addEnd(3);
Output :- 1
4
3
A Map object associates one value (the key) with another value. Both the key and value can
be of any valid X++ type, including objects. The types of the key and value are specified in
the declaration of the map. The way in which maps are implemented means that access to
the values is very fast.
static void Map(Args _args)
{
Map mapTest;
MapEnumerator enumerator;
mapTest = new Map(Types::String, Types::Integer);
mapTest.insert("One", 1);
mapTest.insert("Two", 2);
enumerator = mapTest.getEnumerator();
while (enumerator.moveNext())
{
info(strfmt("Key - %1 , Value - %2.",enumerator.currentKey(),enumerator.currentValue()));
}
Data in containers are stored and retrieved sequentially, but a temporary table enables
you to define indexes to speed up data retrieval.
Containers provide slower data access if you are working with many records. However, if
you are working with only a few records, use a container.
Another important difference between temporary tables and containers is how they are
used in method calls. When you pass a temporary table into a method call, it is passed by
reference. Containers are passed by value.
When a variable is passed by reference, only a pointer to the object is passed into the
method. When a variable is passed by value, a new copy of the variable is passed into the
method. If the computer has a limited amount of memory, it might start swapping memory
to disk, slowing down application execution. When you pass a variable into a method, a
temporary table may provide better performance than a container.
9) Code profier
The Code Profiler measures the execution time of individual lines of code. Use this tool to
find performance bottlenecks and to help understand code that was developed by others.
Dev Work space > Tools > Code profiler
If you click on Profile Run button, call tree and profile lines will be there
10) Maps (AOT Element)
Maps define X++ elements that wrap table objects at run time. With a map, you
associate a map field with a field in one or more tables. This enables you to use
the same field name to access fields with different names but the same data type
in different tables. Map methods enable you to create or modify methods that act
on the map fields.
A table can be accessed through more than one map. Typically, if more than one
map accesses the same table, each map accesses different subsets of fields in the
table.Maps don't define database objects and so they aren't synchronized with
the database.
The benefits of maps include:
Simplicity - maps provide a single interface to fields in multiple tables. This means that any
object referencing the map field can be used against multiple tables without changing any
field names.
Consistency - table fields with varying names can be accessed in code in a consistent
manner. For example by using a map, fields named Zip in one table, ZipCode in another, and
PostalCode in yet another table can all be accessed by the name ZipCode.
Code reuse - a map method enables you to add code that runs against the map fields. A
single map method prevents the duplication of methods and code on each table.
An example of a map in Microsoft Dynamics AX is the Address map, which can be used to
access fields in two tables (among others) called Address and CustVendTransportPointLine.
This enables developers to use one Address map object to access common address fields
and methods.
Map Elements: In Microsoft Dynamics AX, maps are located in the Application Object Tree
(AOT) under the Data Dictionary\Maps node. Each map has four primary elements:
- Fields
- Field Groups
- Mappings
- Methods
Fields: The Fields node contains the map field elements. Each field must be the same data
type as the field to which it's associated. Use the ExtendedDataType property to specify the
map field's data type if the map field is associated with a table field that's based on an
extended data type.
Field Groups: The Field Groups node contains field groups that group together fields that
logically belong together. Field groups in maps work the same way they do in tables. For
more information about field groups, see Best Practices for Field Groups, Defining Field
Groups, and How to: Create a Field Group.
Mappings: The Mappings node is where the map fields are associated with table fields.
Directly under the Mappings node are the MappingTable objects. Each MappingTable object
specifies a table that the map is associated with. Under the MappingTable object are the field
mappings that associate a map field with a table field. If a field exists in the map with no
associated field in a particular table just leave the MapFieldTo property blank.
Methods: This node displays all the methods available from a map. In this node you can
add a new method or you can override methods on the xRecord kernel class and add your
own code.
Map methods are useful because code that acts on the map fields can be encapsulated in a
map method instead of being in multiple table methods. For example, the AddressMap has
a formatAddress method that formats the address consistently whether the map references
the Address table or the CustTable table.
11) Temp Tables
From a developer's perspective, temporary tables store data in the same way as normal physical tables,
except that the data is automatically dropped when no longer required.
They are useful in two common situations
1. As the datasource for a form or report, where the original data is too complex to be easily queried.
2. As temporary storage during complicated processing, to hold the results midway through
the process.
[edit]Types of temporary tables
Prior to Dynamics Ax version Ax 2012, only one type of temporary table was available. In Ax 2012,
however, the Temporary property on tables was replaced with a new property: TableType, which has
three possible values:
Regular - a standard physical table
InMemory - the type of temporary table which existed in the previous versions of Dynamics Ax. Such
tables are held in memory and written to a local disk file once they grow beyond a certain point
TempDB - a new option in Ax 2012. They are "physical" temporary tables held in the SQL Server
database.
The new TempDB tables operate in a similar manner to InMemory tables but support more features from
standard physical tables:
More powerful joins with physical tables are possible, and are properly supported by the database
Can be per-company or global
Support for normal tts transactions1) Difference between conpeek and confind
Confind :- we can find the position of an item.
static void conFindExample(Args _args)
{
container c = ["item1", "item2", "item3"];
int i;
int j;
;
i = conFind(c, "item2");
j = conFind(c, "item4");
print "Position of 'item2' in container is " + int2Str(i);
print "Position of 'item4' in container is " + int2Str(j);
pause;
}
Conpeek:- we can get the item in a particular position
static void conPeekExample(Args _arg)
{
container c;
int i;
;
c = conIns(["item1", "item2"], 1);
for (i = 1 ; i <= conLen(c) ; i++)
{
print conPeek(c, i);
}
pause;
}
2) Method overloading and Method overriding
X++ supports overriding, but it does not support overloading.
Overriding a Method [AX 2012]
The methods in a class are inherited by any class that extends it. You can alter the functionality of
an inherited method by creating a method in the subclass with the same name and parameters as
in the superclass. This is called overriding the method. For example:
// Superclass: Attribute
public class Attribute
{
int objectVariable;
}
void methodAtt()
{
//Some statements
}
// Subclass: ColorAttribute
public class ColorAttribute extends Attribute
{
int addedObjectVariable;
}
void methodAtt()
{
//Some statements
}
ColorAttribute is a subclass of Attribute and therefore inherits the method methodAttr. However,
because ColorAttribute defines a method with the same name and the same number of arguments, the
method in the superclass is overridden.
Preventing Method Overriding
Static methods cannot be overridden because they exist per class. To protect other sensitive methods, or
core methods, from being overridden, use thefinal modifier. In the example below, methodAtt is declared
as final, and so it cannot be overridden in any class that extends Attribute.
public class Attribute
{
int objectVariable;
}
final void methodAtt()
{
//Some statements
}
Note
Overloading is where there is more than one method with the same name, but the methods have different
signatures (return type or parameter lists or both).
Overriding is where the superclass's implementation of a method is altered by the subclass's
implementation of the method, but the signatures of both methods are the same.
3) DictTable and DictField Class
DictTable class is used to access information ralated to table. (if you want to access
the fields of a record, where you do not know the field names ex:- table_name.(field_id)
)
DictField class is used to access information ralated to table fields.
if (!dictField.isSystem())
{
value = custTable.(fieldId); // value of the record will display
if(value)
{
info(strFmt('%1 = %2',
dictField.label(), // field name will display
any2str(value)));
}
}
RecordSortedList: Allows you to insert multiple records in one database trip. Use the
RecordSortedList construct when you want a subset of data from a particular table, and when you want it
sorted in an order that does not currently exist as an index.
Student student;
RecordSortedList recordSortedList = new RecordSortedList(tablenum(Student));
recordSortedList .sortOrder(fieldname2id(tablenum(Student),StudentId));
student.clear();
student.StudentID=123;
student.FirstName=DOM;
student.LastName=FED;
recordSortedList.ins(student);
student.clear();
student.StudentID=456;
student.FirstName=TOM;
student.LastName=GED;
recordSortedList.ins(student);
student.clear();
student.StudentID=789;
student.FirstName=ROM;
student.LastName=TED;
recordSortedList.ins(student);
recordSortedList.insertDatabase();
RecordInsertList: Allows you to insert multiple records in one database trip. Use the
RecordInsertList construct when you do not need to sort the data.
insert_recordset: Allows you to copy multiple records from one or more tables directly into another
table on a single database trip.
update_recordset: Allows you to update multiple rows in a table on a single database trip.
delete_from Allows you to delete multiple records from the database on a single database trip.
6) Difference between update and doupdate
The doUpdate table method updates the current record with the contents of the buffer. This
method also updates the appropriate system fields.
The doUpdate method should be used when the update method on the table is to
be bypassed. Suppose you have overridden the update method of the table but sometime
there is a situation when you don't want the code written in the overridden update method
to be executed and at the same time want any selected record of that table to be updated.
In such situation you should call the table.doupdate() method instead of table.update()
method.
7) Collection Classes
you cannot store objects in arrays (x++ class) or containers. The Microsoft Dynamics AX
collection classes have been designed for storing objects.
Below are collection classes: Set , Map , List , Array (Collection class)
A Set is used for the storage and retrieval of data from a collection in which the members
are unique. The values of the members serve as the key according to which the data is
automatically ordered. Thus, it differs from a List collection class where the members are
placed into a specific position, and not ordered
automatically by their value.
static void Set(Args _args)
{
Set setOne;
Set setTwo;
SetEnumerator enumerator;
Int value;
setOne = new Set(types::Integer);
setOne.add(4);
setOne.add(6);
setOne.add(3);
enumerator = setOne.getEnumerator();
while (enumerator.moveNext())
{
value = enumerator.current();
info(strFmt("%1",value));
}
}
Output :- 3
4
6
A List object contains members that are accessed sequentially. Lists are structures that can
contain members of any X++ type. All the members in the same list must be of the same
type.
static void List(Args _args)
{
List integerList = new List(Types::Integer);
ListEnumerator enumerator;
// Add some elements to the list
integerList.addEnd(1);
integerList.addEnd(4);
integerList.addEnd(3);
// Set the enumerator
enumerator = integerList.getEnumerator();
// Go to beginning of enumerator
enumerator.reset();
//Go to the first element in the List
enumerator.moveNext();
// Print contents of first and second elements
info(strfmt("%1", enumerator.current()));
enumerator.moveNext();
info(strfmt("%1", enumerator.current()));
enumerator.moveNext();
info(strfmt("%1", enumerator.current()));
}
Output :- 1
4
3
A Map object associates one value (the key) with another value. Both the key and value can
be of any valid X++ type, including objects. The types of the key and value are specified in
the declaration of the map. The way in which maps are implemented means that access to
the values is very fast.
static void Map(Args _args)
{
Map mapTest;
MapEnumerator enumerator;
mapTest = new Map(Types::String, Types::Integer);
mapTest.insert("One", 1);
mapTest.insert("Two", 2);
enumerator = mapTest.getEnumerator();
while (enumerator.moveNext())
{
info(strfmt("Key - %1 , Value - %2.",enumerator.currentKey(),enumerator.currentValue()));
}
}
Data in containers are stored and retrieved sequentially, but a temporary table enables
you to define indexes to speed up data retrieval.
Containers provide slower data access if you are working with many records. However, if
you are working with only a few records, use a container.
Another important difference between temporary tables and containers is how they are
used in method calls. When you pass a temporary table into a method call, it is passed by
reference. Containers are passed by value.
When a variable is passed by reference, only a pointer to the object is passed into the
method. When a variable is passed by value, a new copy of the variable is passed into the
method. If the computer has a limited amount of memory, it might start swapping memory
to disk, slowing down application execution. When you pass a variable into a method, a
temporary table may provide better performance than a container.
9) Code profier
The Code Profiler measures the execution time of individual lines of code. Use this tool to
find performance bottlenecks and to help understand code that was developed by others.
Dev Work space > Tools > Code profiler
If you click on Profile Run button, call tree and profile lines will be there
10) Maps (AOT Element)
Maps define X++ elements that wrap table objects at run time. With a map, you
associate a map field with a field in one or more tables. This enables you to use
the same field name to access fields with different names but the same data type
in different tables. Map methods enable you to create or modify methods that act
on the map fields.
A table can be accessed through more than one map. Typically, if more than one
map accesses the same table, each map accesses different subsets of fields in the
table.Maps don't define database objects and so they aren't synchronized with
the database.
The benefits of maps include:
Simplicity - maps provide a single interface to fields in multiple tables. This means that any
object referencing the map field can be used against multiple tables without changing any
field names.
Consistency - table fields with varying names can be accessed in code in a consistent
manner. For example by using a map, fields named Zip in one table, ZipCode in another, and
PostalCode in yet another table can all be accessed by the name ZipCode.
Code reuse - a map method enables you to add code that runs against the map fields. A
single map method prevents the duplication of methods and code on each table.
An example of a map in Microsoft Dynamics AX is the Address map, which can be used to
access fields in two tables (among others) called Address and CustVendTransportPointLine.
This enables developers to use one Address map object to access common address fields
and methods.
Map Elements: In Microsoft Dynamics AX, maps are located in the Application Object Tree
(AOT) under the Data Dictionary\Maps node. Each map has four primary elements:
- Fields
- Field Groups
- Mappings
- Methods
Fields: The Fields node contains the map field elements. Each field must be the same data
type as the field to which it's associated. Use the ExtendedDataType property to specify the
map field's data type if the map field is associated with a table field that's based on an
extended data type.
Field Groups: The Field Groups node contains field groups that group together fields that
logically belong together. Field groups in maps work the same way they do in tables. For
more information about field groups, see Best Practices for Field Groups, Defining Field
Groups, and How to: Create a Field Group.
Mappings: The Mappings node is where the map fields are associated with table fields.
Directly under the Mappings node are the MappingTable objects. Each MappingTable object
specifies a table that the map is associated with. Under the MappingTable object are the field
mappings that associate a map field with a table field. If a field exists in the map with no
associated field in a particular table just leave the MapFieldTo property blank.
Methods: This node displays all the methods available from a map. In this node you can
add a new method or you can override methods on the xRecord kernel class and add your
own code.
Map methods are useful because code that acts on the map fields can be encapsulated in a
map method instead of being in multiple table methods. For example, the AddressMap has
a formatAddress method that formats the address consistently whether the map references
the Address table or the CustTable table.
11) Temp Tables
From a developer's perspective, temporary tables store data in the same way as normal physical tables,
except that the data is automatically dropped when no longer required.
They are useful in two common situations
1. As the datasource for a form or report, where the original data is too complex to be easily queried.
2. As temporary storage during complicated processing, to hold the results midway through
the process.
[edit]Types of temporary tables
Prior to Dynamics Ax version Ax 2012, only one type of temporary table was available. In Ax 2012,
however, the Temporary property on tables was replaced with a new property: TableType, which has
three possible values:
Regular - a standard physical table
InMemory - the type of temporary table which existed in the previous versions of Dynamics Ax. Such
tables are held in memory and written to a local disk file once they grow beyond a certain point
TempDB - a new option in Ax 2012. They are "physical" temporary tables held in the SQL Server
database.
The new TempDB tables operate in a similar manner to InMemory tables but support more features from
standard physical tables:
More powerful joins with physical tables are possible, and are properly supported by the database
Can be per-company or global
Support for normal tts transactions
http://dynamicsaxposed.wordpress.com/
Posted by Ashok kancheti at 9:18 AM