Tuesday, January 13, 2015

Dynamics AX 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.

6.      How can we restrict a class to be further extended?
 using Final Keyword for ex: public final class <ClassName>

7.      Which classes are used for data import export?
SysDataImport and SysDataExport

8.       From which table u can get the user permissions stored in Ax?
      AccessRightList table.

9.      What should we do if we need last record to be active when a form is opened?
            In properties of datasource table set the StartPosition property as last.

10.  What is the sequence of events while a report is generated?
            Init, Run, Prompt, Fetch, send,Print

11.   Name few X++ classes/Coreclasses related to Queries?
     Query, QueryRun, QueryBuildRange, QueryBuildDataSource, QueryBuildLink

12.   What is an index?
An index is a table-specific database structure that speeds the retrieval of rows from the table. Indexes are used to improve the performance of data retrieval and sometimes to ensure the existence of unique records.

13.  Define IntelliMorph
IntelliMorph is the technology that controls the user interface in Microsoft Dynamics AX. The user                   interface is how the functionality of the application is presented or displayed to the user.
IntelliMorph controls the layout of the user interface and makes it easier to modify forms, reports, and menus.

14.  Define MorphX  
The MorphX Development Suite is the integrated development environment (IDE) in Microsoft Dynamics AX used to develop and customize both the Windows interface and the Web interface.

15.  Define  X++   
X++ is the object-oriented programming language that is used in the MorphX environment .

16.  Differentiate refresh(),reread(),research(),executequery()  
refresh() will not reread the record from the database.  It basically just refreshes the screen with whatever is stored in the form cache.
reread() will only re-read the CURRENT record from the DB so you should not use it to refresh the form data if you have added/removed records.  It's often used if you change some values in the current record in some code, and commit them to the database using .update() on the table, instead of through the form datasource.  In this case .reread() will make those changes appear on the form.
research() will rerun the existing form query against the data source, therefore updating the list 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?

30.  What is the function of super()
              This method calls the system methods to execute.
It is used to instantiating the variables at the parent class. Used for code redundancy.
31.  Utility and use of find method.
              All the tables should have at least one find method that selects and returns one record from the table that matches the unique index specified by the input parameters. The last input parameter in a find method should be a Boolean variable called for update or update that is defaulted to false. When it is set to true, the caller object can update the record that is returned by the find method.
32.   What  are the different types of Table groups defined on table properties?
              Miscellaneous
              Parameter
              Group
              Main
              Transaction
              WorkSheetHeader
              WorkSheetLine
33.  Multiple inheritance possible or not, if not how can we overcome that.
In X++, a new class can only extend one other class; multiple inheritance is not supported. If you extend a class, it inherits all the methods and variables in the parent class (the superclass).
We can use Interfaces instead of multiple inheritance in Ax.

34.  Do we need to write main method, give reasons
Yes, but to open the class from action menu item we have to create main method of class.

35.   What is difference between new & construct method
new(): used to create a memory to the object.
Construct():  You should create a static construct method for each class. The method should return an instance of the class.

36.   What is the utility of the RunOn property
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 doesn’t 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)-
- it is useful when you required to return more than 1 values
Pass By Value:
- In this method value of the variable is passed. Changes made to formal will not affect the actual parameters.
- Different memory locations will be created for both variables.
- Here there will be temporary variable created in the function stack which does not affect the original variable.
In case of pass by value, the change in the sub-function will not cause any change in the main function whereas in pass by reference the change in the sub-function will change the value in the main function.
Pass by value sends a COPY of the data stored in the variable you specify, pass by reference sends a direct link to the variable itself. So if you pass a variable by reference and then change the variable inside the block you passed it into, the original variable will be changed. If you simply pass by value, the original variable will not be able to be changed by the block you passed it into but you will get a copy of whatever it contained at the time of the call.
51.   What are the two most important methods on the Report?
Init(),run(),fetch(),send(),print()


52.  When do block the super() method of fetch
Don't call super() when overriding the fetch method in a report

53.   Can we make a report from wizard, if yes from where
Yes, Tools>DevelopmentTools>Wizards>Report Wizard

59. What is a Programmable Section, how we use it in reports
Use programmable sections to add any kind of customized information. To activate a programmable section, activate it explicitly with an element.execute(Number) statement. The Number must be specified in the ControlNumber property for the design section.

60. What is the difference between Auto Design Spec & Generated Design
Auto Design: An auto design is a report design that has a layout that is automatically generated based on the data for the report. You can use auto designs for most common reports. Reusability is available.
This uses Report template and Section template. Header ,Section Group and Footer is not available.
Generate Design or Precision design: You can create a precision design for a report that requires a very precise layout. It doesn’t use Section template and Report template. Reusability is not available.

61. How can we sort the DS, what facility we can get in by placing fields in Ranges
  this.query().datasource(1).addsortfield(fieldnum(tablename,fieldname),sorting:ascending);

62. What is the role of executeSection
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
·                     Extended data types
·                     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

68. Normally what do we attach in Action    - Classes

69. What is difference between select & select firstonly statements
The select statement fetches or manipulates data from the database or both fetches and manipulates data from the database. Results of a select statement are returned in a table buffer variable.
If you are going to use only the first record or if only one record can be found, use the firstOnlyqualifier. This optimizes the select statement for only one record. Do not usewhile select firstOnly.
It is a best practice to use the firstOnly qualifier in find methods on tables.


70. What are the keywords used to access data from "multiple companies" and "one company to another company".
A cross-company query returns data for several companies in a single run.
To create a cross-company query:
In X++, use the crossCompany keyword on the X++ select statement.
In X++, set the allowCrossCompany property method to true on an instance of the Query class.
In the AOT, set the AllowCrossCompany property to Yes on a node under Query.

71. How can we override a lookup
AOT>Form>DatasSource>Fields>FieldName >Lookup
Form>Design>Field>Lookup.

72. How do the following methods work in a form DS.
ds.refresh(), ds.research(), ds.reread(), in what situation we should use these methods
Refresh():  Updates the form by refreshing the view of all records in the data source.
Research():  Rereads the current record from the database.
Reread():   Refreshes the database search defined by the query, specified by theFormDataSource.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.

Overview                                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                        View information about the selected label.

Button
Recreate                                                                      Re-create the selected label.


79. What is Label Intervals?
The SysLabelInterval table contains the settings that control the interval of label IDs that are used to create new labels through the label editor in MorphX.

80. What are the tools you will use to upgrade any object?   
- Compare

81. What is the use of System Documentation/Application Developer Documentation/Application Documentation
System Documentation is intended for developers under the functions subnode there are hundreds of useful functions you will use when programming in x++.
Application Developer Documentation, under this node you find documentation about tables and classes used by Ax. description about tables and classes for developers.

82. What are the classes, Tables, Forms and Methods used to post the sales orders.
SalesTableType and SaleslineType classes will get called while creating the orders.
SalesFormLetter* classes will be used to post the sales order at various document status(packing, invoice etc).
SalesParm* tables are used to prepare the data for posting
CustConfirmJour, CustConfirmTrans - when a sales order gets confirmed
CustPackingSlipJour, CustPackingSlipTrans - when a packing slip is posted.
CustInvoiceTable,CustInvoiceTrans - when an invoice is posted.
These are some of the maily used tables.

83. What are the classes, Tables, Forms and Methods used to post the purchase orders.
84. What are the classes, Tables, Forms and Methods used to post the Ledgers.
85. What are the classes, Tables, Forms and Methods used to post the Inventory.
86. What is the base class to send the on-boad E-mailing.
SysMailer and SysINetMail.
87. What are the storage Dimensions?
Site,WareHouse,PalletId,BatchNumber,SerialNumber
88. What are the Item Dimensions?
Configuration, size,Color
89. What is the difference between RunBase and RunBaseBatch?
RunBase: To create a job or an Action class - a program that carries out processes, such as accepting parameters from the user and then updating records in the database - you use the RunBase framework.
The framework is implemented by the RunBase application class and supplies many features, which include the following:
·                     Query
·                     Dialog, with persistence of the last values entered by the user
·                     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 insertupdate, and delete methods.

92. What is the Runbase Stack?


93. Difference between sql and x++ statement--SELECT-
1.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 CLAUSE-
1.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.

OTHERS-
1.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.

97. Collection classes
You cannot store objects in arrays or containers. The AX collection classes have been designed for storing objects. The classes are implemented in C++ to achieve the maximum performance (they are system classes).
Class
Description
Similar to the array type except that it can hold values of any single type, including objects and records. Objects are accessed in a specific order.
Contains elements that are accessed sequentially.
Associates a key value with another value.
Holds values of any single type; used when order is important.
Can contain values of more than one type. Used to group information about a specific entity.

98. Tables in inventory?
InvetTable,InventTableModule,InventItemLocation, InventDim, InventTrans
BOMTable , WMSShipment.InventColor, InventSize


99. If you manipulate anything which layer would it affect?
The present layer where you are working and below of that layer.


100. What are the components in reports?
Methods , DataSources , Design.

101. How many types of classes are there?
System Classes and Application Classes.

102. Development tools?
Version control , Cross-reference, Code profiler, Debugger, Application Hierarchy Tree,Code Explorer, Reverse Engineer, Number of Records, Embedded Resources,  Wizards, Label.

103. Communication tools

104. Can you say few best practises in ax?

105. What is the difference between sql queries and dynamics queries.
Sql query is Select statement –
Dynamic query – AOT Query and Query class using x++.

106. What is the difference between x++ and c#?
X++ contains code and Sql select statements
C# contains only code.

107.  What are the link types in Ax?
Passive: Linked child data sources are not updated automatically. Updates of the child data source must be programmed on the active method of the master data source.
Delayed: A pause is inserted before linked child data sources are updated. This enables faster navigation in the parent data source because the records from child data sources are not updated immediately. For example, the user could be scrolling past several orders without immediately seeing each order lines.
Active: The child data source is updated immediately when a new record in the parent data source is selected. Continuous updates consume lots of resources.
InnerJoin: Selects records from the main table that have matching records in the joined table and vice versa. There is one record for each match. Records without related records in the other data source are eliminated from the result.
OuterJoin: Selects records from the main table whether they have matching records in the joined table.
And the other records also shown in the main table.
ExistJoin: Selects a record from the main table for each matching record in the joined table.
The differences between InnerJoin and ExistJoin are as follows:
-                      When the join type is ExistJoin, the search ends after the first match has been found.
-                      When the join type is InnerJoin, all matching records are searched for.
NotExistJoin: Select records from the main table that do not have a match in the joined table.

108. What can’t you store in containers
We can’t store objects in containers.
    
109. Difference between arrays and containers
An array can hold only items of same and its declared type. Containers store different types of data types at a time.
You can allocate memory space for an array and fill that space with values later, such as in a loop. This is efficient and performs well.


110. Logic for converting string to uppercase?
StrUpr() -Converts all the letters in a string to uppercase.

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 theFormDataSource.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.

117. Tell us about AIF(MSMQ).
Application Integration Framework (AIF) is the infrastructure within AX with which you can expose business logic or exchange data with other systems. AIF is comprised of three primary components:
1.Services - Enable you to expose business logic written in X++ as a service to be consumed by other applications. Within Microsoft Dynamics AX, you can create, customize, and publish services.
2.Document services - A specific implementation of services in which the Microsoft Dynamics AX business logic is exposed through document services.
3.Consume Web services - In Microsoft Dynamics AX, you can consume external Web services from your X++ code. 

118. How to design a form in AX using X++?
The Form* classes enable you to manipulate, create, modify, or run forms by using X++ code. You can also modify forms during run time so, for example, one or more controls are hidden on a form, depending on the user's selections in the preceding form.
The Form classes are all system classes and are prefixed with Form.
Form, FormRun, FormDesign, FormBuildDesign, FormDataSource, FormBuildDataSource, FormControl

119. What is report builder?
You can create reports by using Report Builder for Microsoft SQL Server Reporting Services. You add information to the report from a report model.
When you create a report by using Report Builder for Microsoft SQL Server Reporting Services, you are using secure views of the tables available in the report model.

120. What is Index, properties in Index and types of Index?
An index is a table-specific database structure that speeds the retrieval of rows from a table. Indexes are used to improve the performance of data retrieval and to ensure the existence of unique records. It's up to the database-specific query optimizer to use available indexes to facilitate efficient data retrieval.
Unique index and non-unique index.

121. Concept of Different Layer in AX.
sys
syp
gls
Glp
hfx
sl1
sl2
sl3
bus
bup
var
vap
cus
cup
usr
usp

122. Difference between bound and unbound controls?
Form controls belong to one of three groups, depending on their data source as follows:
·                     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.
·                     Calculated controls – uses a method as the data source. An example of a calculated control is the sum of two fields on a form.
123. How to create runtime query?
You can create a query to retrieve data by using the query classes.
Query, QueryRun, QueryBuildDataSource, QueryBuildRange, QueryBuildLink,  QueryBuildDynaLink

124. What is optimistic concurrency control and Pessimistic Concurrency Control?
Optimistic Concurrency Control (OCC) helps increase database performance. Pessimistic Concurrency Control locks records as soon as they are fetched from the database for an update. However, Optimistic Concurrency only locks records from the time when the actual update is performed.
Following are the advantages of using OCC:
·                     Fewer resources are used to hold the locks during the update process.
·                     Records are locked for a shorter length of time.
·                     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 UpdateConflictNotRecoveredexceptions.

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 can’t 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 Validateproperty.

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 == “ ” ;

134. What is cache lookup and IsLookup what is it used for?
CacheLookup : Determines how to cache the records retrieved during a lookup operation.
            Types -  None , NotInTTS, Found, FoundAndEmpty,EntireTable.
IsLookup : For report models, it specifies whether the table information is incorporated into other tables that reference it when a report model is generated.
For OLAP cubes, it determines whether to generate a consolidated dimension or a distinct dimension. You can specify one of the following values.
·                     Yes - Indicates that attributes from the table are to be consolidated into the parent dimension (star schema).
·                     No - Indicates that a separate dimension is to be generated for the table (snowflake schema).

135. Difference between table and views?
A Microsoft Dynamics AX view is a virtual table that contains the data records and fields that are specified by a query.Like a table, a view uses fields and rows to represent data records. However, the data in a view is not stored as a database object but is dynamically created when the view is accessed. A view uses a query to retrieve data fields from one or more database tables.
When you create a view, the view definition is generated and stored in the database. When that view is accessed, the view dynamically retrieves the data that satisfies the view definition.
Views are read-only. The data fields and tables that a view uses cannot be updated from that view.
Benefit
Description
Focused data
A view enables you to retrieve and return only the data that is relevant for a particular user or scenario.
Customized data
A view enables you use a complex query to create a highly-customized set of data. For example, a view often represents data as a single table that was retrieved from multiple joined tables and used many conditions.
Performance
A view can improve performance by returning only relevant fields to the user. In addition, a view definition is compiled which may provide better performance than calling an equivalently complex query.




136. In which case delete_from and delete() have same result?
When deleting only one record in the table.
137. Explain sales/purchase order processes in AX.
138. Can you just tell the table properties that you can remember?

139. Explain different types of reports?
            AOT Reports , Using X++ - Report classes, Using Report wizard.

140. Primary Key in tables (In dynamics AX don’t have primary key)

141. What is the default index for a table?
The system index is created on the RecId and DataAreaId fields if the DataAreaId field exists. Otherwise the system index is created on the RecId field. You can see system indexes in the database but they aren't visible in the AOT.

142. What are all the add- on tools you used in Dynamics AX (It’s an indirect question for AIF)
143. Did you work with EP (Enterprise Portal & Workflow) how can you implement this features into your projects?

144. Difference between this and element?
 this & element: this can be used in any objects to reference the current object and member methods.
In forms the collection of objects is contained within a FormRun object. You can reference members in the outer formrun object by using the element reference.
If your code is placed at the top level there are no functional difference between this and element.
If your code is placed in a formdatasource but this will reference the datasource but element will reference the formrun.
You cannot use element to refer table or class object.
145. COM & .NET Business Connector
146. Concurrent user & Named user
147. Primary key & Foreign key
148. AOS Load balancer concept/Clustering
149.  AX 2009 Debugger concepts?
Use this debugger to debug X++ code that is running on the following:
·         Microsoft Dynamics AX Business Connector
·         AOS
·         Microsoft Dynamics AX Client
The debugger windows.         1. Code           2. Variables     3.Call stack     4.Watch           5.Break points 
6. Output


150. Cross reference tool ?
The Microsoft Dynamics AX cross-reference system allows you to see the relationships between objects. You can see the following:
·         Which other objects use the current object
·         Which other objects the current object uses
For example, you can get a list of every piece of code that uses a particular method, or you can see which forms use a particular table field. You can also get information about where labels are used in the application. 
151. Document Management
152. Print Management
153. Caching mechanism in AX ?
            Caching is to remember the information already retrieved from the database and use this memory when the same data is needed again.
Drawback, if the remembered information is no longer valid this could compromise the consistency of the  database as the updates are made based on the invalid data.
Read ahead caching , single record caching, Entire table caching, Record view caching, Display method caching.
154. What is cloud computing? How it is configured in AX?
155. Difference between parameter table and Normal table?
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
·                     A parameter menu item
There should be one parameter table per module.
Parameter tables have a single record per company, holding the required parameters for the module. The record is cached. To enable the Found-cache, a key is defined.
Add an integer field called key. It should have the Visible property set to No

156. What is Configuration form in Ax?
            Administration>Setup>System>Configuration   -- displays all the module configuration keys and we can enable or disable the key from this form.
157. How to change Standard table as temporary table ?
            By changing the table property to Yes and  Use the setTmp table method to make a non-temporary table temporary rather than creating a copy of the table, and then making it temporary.
158. What is difference between Auto design and Generate design ? If we uses both designs in a report what design will be print?
            Report prints  - Generated design.
159. Oops concept what doesn’t support in Ax?
            Multiple inheritance and method overloading
160. Instead of multiple inheritance what we use in Ax?
            Interfaces
161. How to open exe file in Ax?
            Ax32.exe  - "C:\Program Files\Microsoft Dynamics AX\50\Client\Bin\Ax32.exe"
162. What is table properties of formRef and ReportRef ?
For tables where the Table Group property has been set to Group, Main, or WorksheetHeader, you must do the following:
·                     Have a form to maintain the table records.
·                     Set the FormRef property to the name of a display menu item.
The form and the display menu item that are used to start the form should have the same name as the table. An example of this rule is the CustTable table in Microsoft Dynamics AX.
Note
Don't set the FormRef property for tables where the MaxAccessMode property is set to NoAccess. These tables are not used in a form.
Specifies the display menu item that is activated when a table is referenced.
When you use a primary index field on a report, this form is available as a link in the report. A primary index is specified by using the PrimaryIndex property.
If you leave this field blank, the system attempts to display a form that has the same name as the table.
The FormRef property of a table lookups display menuitems.
163. How many types of exceptions are there in Ax?
            15 types of exceptions in Ax are -------
Info, warning,deadlock,error,internal,break,dderror,sequence,numeric,CLR error,Code access security,UpdateConflict,UpdateConflictNotRecovered,DuplicateKeyException,DuplicateKeyExceptionNot Recovered.
164. Access modifiers and Method modifiers ?
Access Modifiers: All methods of a class are always available to code in the class itself. To control access from other classes, and to control inheritance by subclasses, X++ has three access control modifiers for methods:
Classes are treated as public if you do not specify an access modifier.
public :  Methods that are declared as public can be used anywhere the class is accessible and can be overridden by subclasses.
protected : Methods that are declared as protected can only be called from methods in the class and in subclasses of the class where the protected method is declared.
private : Methods that are declared as private can only be called from methods in the class where the private method is declared.
Method Modifiers :  abstract ,client,server,display,edit,final,static,public,private,
protected.

165. How many types of dimensions in inventory?
            Item dimensions – Configuration,size,color
            Storage dimensions – Site, Ware house, PalletId, Batch number, Serial Number.
166. If we create table relation and EDT relation for the same field in the table which relation the field uses?
            Table relation.

167. What is Composite query where we can use?
            A query with in another query is called Composite query. Uses in the Query node in the AOT.

168. Can run the form on server side?  --   No
169. Difference between table delete and form delete?
170.  What is section template and report template?
Report Template: A report template can specify the sections that a report includes, such as a page header and a page footer, page numbers on each page ,company logo ,the controls included in each section, and the layout of the controls. Only reports based on an Auto design inherit changes that are made to a report template, Generate design doesn’t inherit changes to report template.
Section template:  This makes it possible to define sections one time and reuse them many times. This is used for elements appearing in more than one report.
171. When you are creating a table what is the default table group?  -   Miscellaneous

172. Where is the best place to write the logic in Ax?
            Classes, try to avoid the code in the forms.
173. what is the thin and thick or fat client in the configurations?
            Thick client has the direct access to the database.







1.      How to generate the Sales invoice periodically/automatically?
2.      How to send the customer’s report as an E-mail to the particular users on daily status?
3.      What class will call when sending the E-mail?
4.      How to run the debug for the server modifier methods?
5.      What are the delete actions?
6.      What are the relations and examples?
7.      What is Security key and configuration key?
8.      What are the query methods and what is get , getno methods?
In the fetch method of report we call get() and getno() methods. Get is used to get the table from the query or datasource of report, here we will give the datasource table name. and getno() is used to get the query number or datasource table number of a report.
9.      What is the Sales order cycle?
10.  What methods and tables called when posting the sales order?
11.  What is purchase requisition?
12.  What is BOM?
13.  What is abstract class? what are the abstract classes in Ax?
RunBase, RunBaseBatch, FormLetter , FormLetterReport , PurchFormLetter,PurchFormLetterReport, SalesFormLetter, SalesFormLetterReport,RunBaseReport,GanttData ,InventModelType , InventMovement LedgerBalance PrintMgmtHierarchy , PrintMgmtNode ,PrintMgmtSetupSettings , SmmImport SmmOutlookSync , SysCheckList , SysCodeExplorer ,SysDataExpImp , SysDefaultData, SysExcel, SysExcelApplication , SysExcelCell ,SysExcelWorkbooks , SysExcelRange , SysSearch, SysWizard, WorkflowElement, AddressSelectForm, AddressZipCodeImport, AifDocument, AifDocumentService, AssetSumCalc,AssetTableInterval, AssetTableMethod, AxdBase, Barcode, BOMCalcBase, BomCalcJob,BomCalcLine, BOMCopyFrom, CustVendBalanceList, CustVendPaym, CustVendTransData,DimensionCopy
14.  What is interface and what are interfaces classes in Ax?
Batchable, SysPackable, SysComparable, SysMergeable,SysSaveable ,AfService,SysVersionControllable, SysTestExecutable, SysTestListener ,AifXmlSerializable,AifCustomizableService, AifGatewayReceiveManager, AifGatewaySendManager,AifIntegrationAdapter, AifPipelineComponentInterface,AfEmployeeService,WorkflowDueDateProvider,WorkflowHierarchyProviderNode, WorkflowConfigControl, WMSOrderTransMultiUpdateHandleable, DynamicPropertyCallback,RunbaseRecsMapable, SysCompareContextProvider, WorkflowStartedEventHandler, WorkflowCompletedEventHandler,                                                WorkflowCanceledEventHandler,SysVisioModelProvider, SysVersionControlChangeLists, SysVersionControlReviews, , SysTaskRecorderIEventMonitor, SysImportStatusGettable,SysImportLoggable, SysCheckListInterfaceUpgrade, ButtonStateProvider
15.  What is polymorphism?
16.  What is primary index ,clustered index?
17.  Write a program for reversing the string?
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 non-final 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 (software’s).
30)  Weather Workflow requires EP?
31)  What is EP? What it requires (software’s). 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 didn’t 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?
7. What is the frameworks in Ax ?
8. What is Run base framework?
9. When we create the dialog run method is needed? If not how to run the method?
10.  Is it possible to move the var layer modifications to usr layer? For ex ; if one user has created objects in var , how we can move these objects to usr layer?  ---- by using compare tool
11. How to move modifications from dev instance to Test and Prod instance?
12. What is layer architecture?
13. What is the return type of unpack() method ?

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.

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
}
NoteNote
You should not specify new or finalize methods as final.
For more information about inheritance in X++, see Creating a Subclass.



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.


    static void dictJob(Args _args)
{
    DictTable   dictTable = new DictTable(tableNum(CustTable));
    DictField   dictField;
    int         counter, fieldId;

    CustTable   custTable;
    anytype     value;

    select firstonly custTable;

    for (counter = 1; counter <= dictTable.fieldCnt(); counter++)
    {
        fieldId = dictTable.fieldCnt2Id(counter);
        dictField = new DictField(tableNum(CustTable), fieldId);

        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)));
            }
        }
    }
}


4) Difference between Array collection class and x++ arry class

An Array collection class can hold the objects.
x++ array class holds primitive data types such as str,int

5) What should we use to increase performance while inserting, updating or deleting records from a table?
ANS:
·         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)

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

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

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()));
    }
}

Output:- Key - One , Value  - 1.
                Key - Two , Value  - 2.

8) Difference between Containers and Temp tables
·         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.

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
}
NoteNote
You should not specify new or finalize methods as final.
For more information about inheritance in X++, see Creating a Subclass.



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.


    static void dictJob(Args _args)
{
    DictTable   dictTable = new DictTable(tableNum(CustTable));
    DictField   dictField;
    int         counter, fieldId;

    CustTable   custTable;
    anytype     value;

    select firstonly custTable;

    for (counter = 1; counter <= dictTable.fieldCnt(); counter++)
    {
        fieldId = dictTable.fieldCnt2Id(counter);
        dictField = new DictField(tableNum(CustTable), fieldId);

        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)));
            }
        }
    }
}


4) Difference between Array collection class and x++ arry class

An Array collection class can hold the objects.
x++ array class holds primitive data types such as str,int

5) What should we use to increase performance while inserting, updating or deleting records from a table?
ANS:
·         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)

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

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

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()));
    }
}

Output:- Key - One , Value  - 1.
                Key - Two , Value  - 2.

8) Difference between Containers and Temp tables
·         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

1 comment: