Tuesday, 25 November 2014

AX interview Questions and answer

How to separate objects which are present in a particular layer and take XPO.
This is my take on a step by step procedure to achieve this.
Step 1. Create a model and move all the objects that you want to move out of the layer.
Step 2. Create a project of this model and export the project as an xpo.
Step 3. Backup the database and delete the old model created in step 1
Step 4. Synchronize the database from the AOT. This will delete the data but we will retrieve it later.
Step 5. Import the xpo from step 2
Step 6. Synchronize the database.
Step 7. Export this new model.
Step 8. Restore the database that was backed up from step 3
Step 9. Import the new model (step 7), Synchronize and compile
This restores the I’d values of the objects and tables / fields. So no data will be lost
Step 10. Delete old model, compile / synchronize.
This should successfully move the code into the new layer and you won’t loose any data.

2)Does hot fix and certified solution layers in AX 2009 have patch layers?
A patch is installed for Dynamics AX 2009 by clicking on axpatch.exe and following the prompts from the installer.  The *.cab file contains the Microsoft signed .xpo as well as an .xml file which directs the installer to the appropriate layer to patch.
The folder named licenseterms contains the license terms used in the installer for each of the supported languages.  In the support folder the 24 languages for the patch installer are included as well as necessary files for managing the import of a patch.
The kbXXXXXX.txt file contains the affected objects including methods.  This is helpful in initial analysis to determine if the affected object has been modified on your system in any other layer.  After the initial analysis the patch can be applied to a test system and the compare tool inside of Dynamics AX can be used to analyze any changes that need to be made to merge the patch into the environment before being deployed on the live system.
Additionally, once an application patch has been applied a new class can be found in the Application Object Tree (AOT) called SysHotFixManifest.  This class will contain a method with the KB Article number representing each patch applied to the system.  This is done to allow the tracking of patches deployed in AX 2009 as the application version cannot be incremented when using individual patches.
In summary, Dynamics AX 2009 can be patched via a Microsoft signed .xpo file in a specific layer.  This enables better tracing of installed patches as well as isolating Microsoft code from customizations and third party applications.  The patches installed on an environment can be seen in the SysHotFixManifest class and will appear as methods indicating each KB Article applied.
For additional information on patching Dynamics AX 2009 please see the Dynamics AX 2009Patching Whitepaper which has been published on PartnerSource\CustomerSource.

What is the size of model element ID? Each object in a particular layer has an ID. What is the size/length of it?
16  bit – ax 2009 object id
32 bit in ax 2012 object id
Not sure of model  element ID
Which class/framework to use to show the remaining time of a task.
SysOperationProgress progress = new SysOperationProgress(3);

What is the use of Reverse engineering tool?
The Reverse Engineering tool enables you to visualize data and classes in Microsoft Dynamics AX by creating UML data models, UML object models, and ERX ER data models. This section provides an overview of the reverse engineering features and explains how to create models using this tool.
What is LITERALSTR function?
Validates that the specified string can be a literal string; if not, a compiler error occurs.

str literalStr(int str)

{
str s;
;

s = literalStr("This is a literal str");
print s;
pause;
}


Difference between FIRSTONLY and FIRSTFAST
First fast will fetch the first record fast and then rest of record time taken by  to fetch the first fast and first only is same for the first record
Give an example using conditional operator.
Arithmetic operator MOD. What is the return value? Say 10 MOD 8.
Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 ... mod. i = 100 mod21;. Returns the remainder of the integer division of 100 by 21. i=16
Syntax of WINDOW statement.
X++ provides a print statement that allows you to display text or selected results in a temporary window. The messages are displayed in a Print window that appears when the first print statement is executed.
The print statement can be a convenient alternative to the Global::info method during testing. The info method displays text in the Infolog window. The following table compares the print statement against the Global::info method.

How to get number of affected records in set based operations like UPDATE_RECORDSET, INSERT_RECORDSET & DELETE_FROM

update_recordset resembles delete_from in X++ and to UPDATE SET in SQL. It works on the database server-side on an SQL-style record set, instead of retrieving each record separately by fetching, changing, and updating.
MyTable myTableBuffer;
;
update_recordset myTableBuffer
setting field1 = field1 * 1.10;

Is X++ case sensitive language. If No, when it becomes case sensitive?
CLR types are case sensitive  that is exception in ax 2012

What is the function to create DATETIME? Syntax?
utcdatetime myUtc2 = 1988-07-20T13:34:45;
int iDay = DateTimeUtil ::day(1988-07-20T13:34:45)

Does X++ support multiple inheritances?

Yes. Interfaces are allowed as well, to get around multiple Inheritance.

n X++ an interface is a specification for a set of public instance methods. To create an interface, you begin by using the AOT to create a class. You edit the code of its classDeclaration node to replace the keyword class with the keyword interface. Then you add methods to the interface just as you would for a class, except no code is allowed inside the method bodies.
The purpose of interfaces is to define and enforce similarities between unrelated classes without having to artificially derive one class from the other.
Implements and extends
You can add the 
implements keyword on a class declaration, and this requires the class to declare the methods that are specified by the interface. A class declaration can implement multiple interfaces by listing them after the single occurrence of the implements keyword, with commas separating the interface names.
An interface can extend another interface by using the extends keyword. An interface cannot extend more than one interface.
Public
All interfaces are public regardless of whether you explicitly write the keyword 
public in front of the keyword interface in the classDeclaration. The methods on an interface are also public, and again the explicit inclusion of the keyword public is optional.
All interface methods that a class implements must be declared with the explicit keyword public in the class. Also, a class that implements an interface must also be declared with public.

How to make a class not to be extended by other classes?
Final keyword
How to make a form modal?
In most cases CONSTRUCT method in a class is PUBLIC. But in which case it should be PRIVATE?
Static Construct():
This method returns an instance of the class. It is a best practice to have a construct method in your class. This method should always be static but can be public or private depending upon the use. When calling a class from another class or job construct method can be used for this

Example class for Observer/Listener pattern?
For example, you can look at listeners in unit testing framework, especially SysTestResult class (and its methods addListener(), addFailure() and so on).
Difference between FIND and EXISTS method in table.
Exist- faster, returns Boolean
Find-slower and returns table
What are the ways to implement GO TO THE MAIN TABLE form functionality?
a)If u want to get go to main Table .Pls follow simple steps
Create a Menu Item  for the form and Attach Particular MenuItem as FormRef Property of Particular Table.
Eg:
Suppose if i want to display  FormA(Using TableA) as Go to Main Table in any other Form then i ll Create a Menu Item for FormA and i wll Attach this MenuItem as FormRef in TableA Property.
b) normal relation to another table the  option will come automatically.

Difference between ACTIVE, DELAYED, PASSIVE Link/Join Types in form DATASOURCE.
Active link type update the child data sources without any delay when you select the parent table record. When you deal with more records it will be affect application performance.
Delay form data source link type is also same as active method the different is delay method won't update immediately when you select the parent record. It will update the child data source when you select the parent table, Ax use pause statement before update the child data source. For example, if we are dealing with lot of records so, when the user click or scroll the order, order details will update without any delay if we use active method.
Passive form data source link type won't update the child data source automatically. For example if we select the parent table order then order details child data source won't update. If we need to update the child data source we need to call the child data source execute query method by program (code).
Outer join form data source link type will return all parent records and matched child records. It will return all rows in the parent table. Here, Order 4 doesn't has the child records (order details) but it is populating in the order grid. It is the difference between inner join and outer join
Inner join form data source link type displays the rows that match with parent table and child table. For example if the order doesn't has any order details then the order will not be display.

Here, Order 4 does not has the order details records, so it is not coming in the order grid.
Exist join
Exist join form data source link type return matched rows of the parent table. It behaves like inner join but the different is once parent row matched with child records then stop the process and update in the grid, Ax won't consider how many records in child table for the parent row.

Notepad: example1. Your comments?
To show the query in a dialog box, what method should be overridden?
What are OLAP and OLTP? Explain with examples W.R.T AX
 In a banking System, you withdraw amount through an ATM. Then account Number, ATM PIN Number, Amount you are withdrawing and Balance amount in account are operational data elements.

An OLAP (On-line Analytical Processing) deal with Historical Data or Archival Data, and it is characterized by relatively low volume of transactions.  In addition, the Queries needed for these systems are often very complex and involve aggregations as for OLAP systems the response time is an effectiveness measure.

Example: If we collect last 10 years data about flight reservation, the data can give us much meaningful information such as the trends in reservation. This may give useful information like peak time of travel, and what kinds of people are traveling in the various classes available (Economy/Business).


ource of data
Operational data; OLTPs are the original source of the data.
Consolidation data; OLAP data comes from the various OLTP Databases
Purpose of data
To control and run fundamental business tasks
To help with planning, problem solving, and decision support
What the data
Reveals a snapshot of ongoing business processes
Multi-dimensional views of various kinds of business activities
Inserts and Updates
Short and fast inserts and updates initiated by end users
Periodic long-running batch jobs refresh the data
Queries
Relatively standardized and simple queries Returning relatively few records
Often complex queries involving aggregations
Processing Speed
Typically very fast
Depends on the amount of data involved; batch data refreshes and complex queries may take many hours; query speed can be improved by creating indexes
Space Requirements
Can be relatively small if historical data is archived
Larger due to the existence of aggregation structures and history data; requires more indexes than OLTP
Database Design
Highly normalized with many tables
Typically de-normalized with fewer tables; use of star and/or snowflake schemas
Backup and Recovery
Backup religiously; operational data is critical to run the business, data loss is likely to entail significant monetary loss and legal liability
Instead of regular backups, some environments may consider simply reloading the OLTP data as a recovery method

Use of CACHEADDMETHOD.
public void init()
{
    super();
    this.cacheAddMethod(tablemethodstr(VendTransOpen,
        nextCashDiscDate));
    this.cacheAddMethod(tablemethodstr(VendTransOpen,
        nextCashDiscAmount));
}


To cache display methods perormance
When a class extends RUNBASE, what should be the RUNON property and why?
TEMP TABLES – In which tier they will be created.
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

Notepad: example2. How many database calls? How can the code be written for better performance?
What are set-based operations?
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.
Allows you to insert multiple records in one database trip. Use the RecordInsertList 
construct when you do not need to sort the data.
Allows you to copy multiple records from one or more tables directly into another
 table on a single database trip.
Allows you to update multiple rows in a table on a single database trip.
Allows you to delete multiple records from the database on a single database trip.

What happens when we use set-based operations on temporary tables?
The X++ SQL statement update_recordset enables you to update multiple rows in a single trip to the server. This means that certain tasks may have improved performance by using the power of the SQL server.
update_recordset resembles delete_from in X++ and to UPDATE SET in SQL. It works on the database server-side on an SQL-style record set, instead of retrieving each record separately by fetching, changing, and updating.
If the update method is overridden, the implementation falls back to a classic looping construction, updating records one by one just as delete_from does for deletions. This also means that the construction works on temporary tables, and whole-table-cached tables by using the looping construction.
When the table is cached  by using Entire table settings
When you set a table's CacheLookup property to EntireTable, all the records in the table are placed in the cache after the first select. This type of caching follows the rules of single record caching. This means that the SELECT statement WHERE clause must include equality tests on all fields of the unique index that is defined in the table's PrimaryIndex property.
When is a set-based operation downgraded to record-based operation?

Insert or the AOSvalidateInsert methods are overridden on the target table
alert are set to be triggered  by insert  into target table
The database log is  configured to  log insert  into the target table
Record level security is enabled on the target table , if the RLS is  enabled on source table then insert record set is not down graded by a row by row operation
Validtimestatefield type property is set as none as property for a table
Notepad: example3. Will RECORDINSERTLIST.ADD (CUSTTABLE) insert record in DB?
{
    RecordSortedList recordSortedList;
    CustTable        custTable;
    ;
 
    recordSortedList = new RecordSortedList(tablenum(CustTable));
    recordSortedList.sortOrder(fieldnum(custTable,AccountNum));
    ttsbegin;
 
    // Prepare record #1 for insertion.
    custTable.AccountNum = '1000';
    custTable.CreditMax = 10000.0;
    recordSortedList.ins(custTable);
 
    // Prepare record #2 for insertion.
    custTable.AccountNum = '2000';
    custTable.CreditMax = 500.0;
    recordSortedList.ins(custTable);
 
    // Prepare record #3 for insertion.
    custTable.AccountNum = '3000';
    custTable.CreditMax = 9999999.9;
    recordSortedList.ins(custTable);
 
    // All three records inserted in one database operation.
    recordSortedList.insertDatabase();  
    ttscommit;

Notepad: example4. Which is the best type and why?
Default cache mechanism/type for AX system tables.
Not sure didn;t found the answer in net
What is the maximum record limit for client and server cache? What happens when the maximum is reached?
client cache is 100 records per table for a given company.
. The maximum number of records maintained in a server cache is 2,000 records per table for a given company.
To know whether a record is fetched from client cache, server cache or database, use wasCached() of the TableBuffer used in Select.

 
select * from salesTable where salesTable.salesId == 'AR_2009';
info(strfmt("%1",salesTable.wasCached()));


Notepad: example5. Walkthrough the code and explain.
Notepad: example6. We can update a record with out transaction integrity check. How?


how to put a degbugger in sales form letter or in batch job????

what are the types of exception thrown in ax 2012???

what are the types of validation in ax 2012????

which method is called first validatewrite or modified field

ans: the validate write is always called first and then the modified field try putting a debugger in both the method and see changing the vaulue of the field you will come to know that first always validate write will get tr9iggered.

Question -why we can't filter display methods in ax ???

ans - When you filter data, AX adds an appropriate WHERE clause to the query to database. Because display methods don't exist in database, it's impossible to create such a WHERE clause. Therefore you can't filter by display methods.

Question: how many ways can you insert the data in container
Question:diffrence between List and set as collection class
Question: what are uses of titlefield1 and title field2 apart from displaying in the form header.




1 comment:

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...