Skip to main content

Posts

Showing posts from 2015

Splitting Sring through X++ in DAX

  Splits a string into a list of substrings delimited by elements in the specified delimiter string. static void StringSplit(Args _args) {        List            list = new List(Types::String);     container PackedList;     ListIterator  iterator;     str can = "Lev_Sales00001_1";         list = Global::strSplit(can,"_");     iterator = new ListIterator(list);     while(iterator.more())     {       PackedList +=   iterator.value();         iterator.next();     }     info(conPeek(PackedList,1));         } output :  

To pass enum (standard base enum  statusOrder)as input parameter to contract class and it has to return string value

For example                          If I pass “OnOrder” enumerator it has to return “Accept” string.       public str parmEnumValue( str _enumString = statusString) {     DictEnum dictEnum = new DictEnum( enumNum (StatusIssue));         StatusIssue statusIssue = dictEnum.symbol2Value(_enumString);          str enumString;          switch (statusIssue)     {         case StatusIssue::OnOrder:             enumString = 'Accepted' ;                 break ;   ...

Code Optimzation in AX 2012

1.  Smart  Joins   :                    Try to Use Joins instead of nested while loop  wherever possible. 2.  Select Statement  :                       Mention the field names in the select statement  instead of fetching entire row, this will reduce  data amount to transfer from database.                                  e.g " Select Itemid from inventTable " 3.  Display Methods  :                               Make sure that generic display methods should be  moved at   table  level and cached by  using"Formdatasource.cacheAddmethod".  4.  Local caching...

Debugging Technics in X++ (AX)

Interrupting the code execution : When you have written some code that is causing an endless loop (or a very long execution) and you want to know what code is currently keeping the client busy. The easiest way is pressing [Ctrl] + [Break] on the keyboard. This will stop the code execution and show up a message box: Are you sure that you want to cancel this operation? If you hold down the [Shift] button on the keyboard while you click at the No button of the message box, the AX Debugger will be launched exactly at the line of code that was about to be executed. From here you can continue to step over / into line by line and try to identify the cause of your endless loop. If breakpoint is sometimes not hit? Sometimes it happens that a breakpoint is not hit although you are sure the respective code was executed  instead of putting a breakpoint at a line of code insert the breakpoint keyword. public void executeQuery() { breakpoint; super(); } How can I get the curr...

Exporting xpo'ss throught X++

 Job used for build batch application to take backup of developement in terms of xpo . Following job illustrates how to export/backup all AOT Classes object. void ExportXpoExample() { TreeNode treeNode; FileIoPermission perm; #define.ExportFile(@”c:\AOTclasses.xpo”) #define.ExportMode(“w”) perm = new FileIoPermission(#ExportFile, #ExportMode); if (perm == null) { return; } perm.assert(); treeNode = TreeNode::findNode(@”\Classes”); if (treeNode != null) { // BP deviation documented. treeNode.treeNodeExport(#ExportFile); } CodeAccessPermission::revertAssert(); }

Steps for Number Sequence Creation

Simple Steps To Create Number Sequence In Ax2012            Creating number seq: We Have to take a EDT name as "Loan Id" and create in number sequence.For that first we should select a module for new number sequence for example Human resourse module.                                     steps: 1.  Create an edt : LoanId .      AOT >> Extended Data Types >> New  >> Properties >> Name  >> Loan Id. 2. Write a code on lode module() on NumberSeqModuleProject {     datatype.parmDatatypeId(extendedTypeNum(Loan Id));      datatype.parmReferenceHelp(literalStr("@Lev853483"));      datatype.parmWizardIsManual(NoYes::No);   ...

Dynamics AX Caching

Cache Location Caches are used on both the client and the server. The Microsoft Dynamics AX runtime manages the cache by removing old records when new records are added to the cache. Client Cache A client-side cache can be used only by the client. The client cache is used when a select is executed from the client tier. If no record is found in the client cache, the client then searches the server cache for the record. If the record isn't located in the server cache, it's retrieved from the database. The maximum number of records maintained in a client cache is 100 records per table for a given company. Server Cache A server-side cache can be used by any connection to the server. The server cache is used when a select is executed on the server tier. If no record is found in the cache, it's retrieved from the database. The maximum number of records maintained in a server cache is 2,000 records per table for a given company. Record Caching Microsoft Dynamics AX...

Removing dublicate using Containers or set through X++

Using Set :  static void Job38(Args _args) {      container       c1 = [1,2,2,3,4,5,6,6,7,7,8];     container       c2;       Set             set = new set(Types::Integer);       SetEnumerator   se;       int             i;         // Load the containre into the set     for (i=1; i<=conlen(c1); i++)          set.add(conpeek(c1, i));     // Get the enumerator for traversal      se = set.getEnumerator();     // Unload the set back into the c2 container       while (se.moveNext())     ...

Form calling sequence

1).when form is getting closed: canclose method get call - can close return boolean true then only close method gets called SQ:- Canclose()-Close(). 2)Sequence of closing form using Ok command Button SQ:- CloseOk()-Canclose()-Close. Cancel command Button - save record property should be set to "NO". 3)Sequence of using Command button Cancel SQ:-ClosedCancel()-Canclose()-Close(). 4).When You Create a new record Using "Ctrl+N" SQ:- Create of DS- Initvalue() of DS -Initvalue() of Table. 5)When user tries to delete a record from The Form SQ:-Validate delete() of DS- Validate delete () of Table -Delete() of DS- Delete() of Table 6).Any critical Validation for The form alone SQ:-Write The logic in The Validatedelete() of DS 7).When a record is Saved from the form SQ:-Validatewrite() of DS- Validate write() of table- write() of ds -Write of Table() -Insert /Update of Table