Pages

Wednesday 12 February 2014

How can we change which fields are displayed in ax


In general, it wouldn't be advisable to change either the TitleField properties, or the indexes, purely to change what is displayed on a lookup form. Luckily, Axapta gives us as easier way to achieve the same goal.
If the AutoLookup field group on the base data table has been filled, then those fields will be used irrespective of the usual logic. Modifying this field group is the easiest way to change which fields appear in lookups against that table.
Bear in mind that while you can add display and edit methods to your AutoLookup field group, the values will not display correctly unless all required fields for calculations are also included in the field group. For example, if you want to show the name of a vendor, based on the VendAccount stored on a record, then the VendAccount itself must also be included in the group. This is because the lookup query only fetches the fields from the database which are actually to be displayed, rather than the entire record.

Lookups in ax


Lookups are used in Axapta to show the user a list of possible values from which to select, whilst entering data into a control on a form.

Automatic lookups
Axapta has extensive support for automatic lookups, as well as the capability to manual enhance or replace the automatic system.
The standard lookup for customer accounts

Introduction

The standard lookup system in Axapta is based on the use of table field or data type relations. These specify a link between a particular data type, or particular table field, and a corrsponding field in another table containing the base (reference) data.
Generally, relations are made on the datatype (EDT) in the AOT, and will then automatically apply to any table field using that EDT.

For example, in the standard application, the CustAccount EDT has a relation specified to CustTable.CustAccount. This means that any table field using the CustAccount EDT will be automatically given a lookup icon which allows the user to select from the list of accounts in CustTable.
It is possible to further restrict the values which will appear in the lookup by specifying a "Related fixed field" relations on the datatype. In this case, only those values satisfying the relation will be shown in the lookup. See the Dimension datatype for an example of this (each Array Element has it's own relation defined

Abstract methods in ax 2012


Abstract methods are used when you wish to force the developer of a sub-class to override the method and provide functionality.

Methods are declared as abstract by using the abstract keyword,

 for example "

public abstract void abstractMethod()
{
}
No code or declarations are allowed inside an abstract method.
·         It is not possible to declare a method as abstract unless the class is also declared as abstract.

·         If a sub-class is created which does not override the abstract methods in its parent, then a compile error will occur where that sub-class is used.

Tuesday 11 February 2014

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.

What are the classes involved in Journal, Sales order Invoice, Purchase order invoice posting?


Journal Posting: LedgerJournalCheckPost
Sales Order Posting: SalesFormLetter, SalesFormLetter_Invoice

Purchase Order Posting: PurchFormLetter, PurchFormLetter_PurchOrder, PurchFormLetter_ReceiptList, PurchFormLetter_PackingSlip, PurchFormLetter_invoice

Table Relations in dynamics ax

Table Relations
·         Normal to specify relation fields without conditions.
·         Field Fixed to specify relation fields to restrict the records in the primary table.
·         Related Field Fixed to specify relation fields that restrict the records in the related table.

1.       For Normal, enter the following in the Field Relation property pages:
·         In the Field property, select the field in the primary table that relates to a field in the related table.
·         In the Related Field property, select the field in the related table.

2.       For Field Fixed, enter the following in the Field Relation property pages:
·         In the Field property, select the field in the primary table to use to restrict the records.
·         In the Value property, enter the value of the selected field as the filter. This relates only records in the primary table that match that field value. Only numeric values can be entered in the Value property. Field fixed relations can be created only on numeric fields.
Each of the related fields are ANDed in the table relation.

3.       For Related Field Fixed, enter the following in the Field Relation property pages:
·         In the Value property, enter the filter value of the selected field. This causes only records in the related table that match that field value to be related. Only numeric values can be entered in the Value property. Related field fixed relations can be created only on numeric fields.
·         In the Field property, select the field in the related table to restrict the records.

Each of the related fields are ANDed in the table relation. 

What is new in AX 2012


·         EDT relations have been moved to table level.
·         The UnitOfWork class to simplify database transaction management.
·         Inheritance among tables, similar to class inheritance.
·         Full text index support to quickly query words that are embedded in the middle of a string field of a table.
·         TempDb tables are a second type of temporary table, in addition to the legacy InMemory temporary table. TempDb tables can be joined to regular tables in a query.
·         Computed columns in a view.
·         Filters on queries that perform an outer join.
·         Disabled tables can be retained in the underlying database for access by external applications.
·         Best practice compiler-enforced checks are updated to reflect new features added for this release. Emphasis is on security and evaluating existing rules that generate warnings. Warnings that require action have been promoted to errors. Minor warnings that are typically ignored have been removed.
·         A form style checker tool is integrated into the Best Practice tool.
·         Enterprise Portal is now based on Microsoft SharePoint 2010. New user controls and support for Microsoft Dynamics AX 2012 features significantly enhance the usability. The developer experience has been improved.
·         New and enhanced features are available in the MorphX development environment. This topic describes:
  • Models and the model store
  • Object IDs
  • The AxUtil command line utility
  • The new development environment
  • Installation-specific IDs
·         SQL Server Reporting Services is now the primary reporting platform for Microsoft Dynamics AX 2012.
·         New features in Visual Studio Tools enable integrated development with Visual Studio.
·         New and enhanced features for Workflow include a new Workflow Editor with advanced controls, line item workflows, and automated workflows.
·         Microsoft .NET Framework is integrated with Microsoft Dynamics AX in the following ways:

  • X++ code can now be compiled into the common intermediate language (CIL) of Microsoft .NET Framework. This enables services and batch jobs to run faster.
  • .NET interop to X++ is now supported. Microsoft Visual Studio can now automatically generate C# (or Visual Basic) code for proxy classes that wrap X++ classes and tables.
  • Events are now supported in X++. The AOT provides useful nodes that make implementation easier. Events can be used to reduce the need to change custom code when you upgrade to newer versions of Microsoft Dynamics AX. Event handler methods can be written in X++ or in any Microsoft .NET Framework language.
  • Attribute classes can be used to add metadata to classes, tables, and methods.
  • The X++ language has the new keywords as and is. You can use the is keyword to test for inheritance relationships during run time. You can use the as keyword to verify the correctness of your downcast assignments during run time. 

MapIterator and MapEnumerator in ax


Map enumerators start before the first element in the list. You must call the  MapEnumerator.moveNext method to make it point to the first element in the list.

It is better to use MapEnumeratorClass  than MapIterator. Map iterators and the maps over which they iterate must be on the same Client/Server side. If you use MapIterator, and code is marked as Called from, it is possible that the map and the iterator will end up on different tiers, and the code will fail. If you use  MapEnumerator, the enumerator is automatically created on the same tier as the map. Also, to move to the next item in a map you must explicitly call the more and next methods if you are using a map iterator. If you use  MapEnumerator, you only have to call moveNext method.

The sequence in which the elements are inserted does not determine the order in which they occur. The order is defined by the ordering of the elements. Elements with lower keys appear before elements with higher keys. The usual ordering for the types is used. However, if the keys are objects, the addresses of the objects are used to supply the ordering and no specific ordering may consequently be inferred. The addresses of the objects are transient by nature.


The only situation where you have to use a map iterator is when you want to delete items from a list (use the MapIterator.delete method).

Indexes in ax


The advantages of indexes are as follows:
·         Their use in queries usually results in much better performance.
·         They make it possible to quickly retrieve (fetch) data.
·         They can be used for sorting. A post-fetch-sort operation can be eliminated.
·         Unique indexes guarantee uniquely identifiable records in the database.
The disadvantages of indexes are as follows:
·         They decrease performance on inserts, updates, and deletes.
·         They take up space (this increases with the number of fields used and the length of the fields).

·         Some databases will monocase values in fields that are indexed. 

What is RunBase Framework in ax


The RunBase framework provides a standardized approach to creating processes and batch jobs in Microsoft Dynamics AX. The framework must be used for every job-style function in the application.
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
·         Batch execution for users to schedule jobs. This functionality uses the RunBaseBatch  class) and the pack and unpack methods with versioning.
·         Progress bar
·         Run

·         Client/server-optimized

Sunday 9 February 2014

Difference between Abstract class and Interfaces


·         An abstract class may contain complete or incomplete methods. Interfaces can contain only the signature of a method but no body. Thus an abstract class can implement methods but an interface cannot implement methods.
·         An abstract class can contain fields, constructors, or destructors and implement properties. An interface cannot contain fields, constructors, or destructors and it has only the property's signature but no implementation.
·         An abstract class cannot support multiple inheritance, but an interface can support multiple inheritance. Thus a class may inherit several interfaces but only one abstract class.
·         A class implementing an interface has to implement all the methods of the interface, but the same is not required in the case of an abstract Class.
·         Various access modifiers such as abstract, protected, internal, public, virtual, etc. are useful in abstract Classes but not in interfaces.

·         Abstract classes are faster than interfaces.

How can we restrict a class to be further extended?



Using ‘final’ Keyword for ex: public final class <ClassName>