Search This Blog

Wednesday, December 21, 2011

Search un-used EDT'S using X++


To find unused EDT’s in your Dynamics Ax application, the following code will sscan through the crossreference and display the EDT’s on screen.
Note, you will have to compile your application with crossreference turned on, otherwise you may get all your EDT’s as not used
//True if used
private boolean FindEDTUsed(extendedTypeId _id, str 40 name)
{
   XRefNames   xRefName;
   boolean ret = true;
   ;


   select firstonly xRefName
           where xRefName.kind == xRefkind::ExtendedType
            && (xRefName.name == name);

  if(xRefName.RecId)
  {
    ret = true;
  }
  else
  {
   ret = false;
  }
  return ret;
}

public void run()
{
  Dictionary dict = new Dictionary();
  int types;
  int i;
  int first = true;
  Set         unusedEDT;
;
 unusedEDT = new Set(Types::Integer);
 //Find list of EDT
 types = dict.typeCnt();
 info(dict.typeName(dict.typeCnt2Id(1)));

  for(i = 1; i <= types; i++)
  {
  //process each type
    if(!this.FindEDTUsed(dict.typeCnt2Id(i), dict.typeName(dict.typeCnt2Id(i))))
    {
       if(first == true)
       {
         info('Unused EDT List');
         first = false;
       }
       //unusedEDT.add(dict.typeCnt2Id(i)); 
       //store it in a set for later use
       info(dict.typeName(dict.typeCnt2Id(i)));
    }
  }
}

Validate Table Fields using X++



The following job is used to validate the fields same as like validatefield method in the form for the table.

You can create this method as the static method in any of your class and call that method and it will returns the table got valid data or not.

static server Boolean krishh_validateTable(common _common)
{
   boolean ret = true;
   SysDictTable    dictTable;
   int fieldCnt, i;
   fieldId fieldid;
   ;

    dictTable = new SysDictTable(_common.TableId);
    fieldCnt= dictTable.fieldCnt();
    for(i = 1; i <= fieldCnt; i++)
    {
       fieldid= dictTable.fieldCnt2Id(i);
       ret = ret &&;
       _common.validateField(fieldid);
    }
    return ret;
}

Friday, December 16, 2011

Sales Invoice using X++

You can use this job to generate the sales Invoice Report.
SalesConfirm report can be done by replacing the reportname,salesformletter_confirm,and object shouldbe custconfirmJournal.

 static krishh_TestSalesInvoiceReport(Args  _args)
   {
    Args                args;
    ReportRun           reportRun;
    SalesFormLetter     salesFormLetter;
    PrintJobSettings    printJobSettings;
    CustInvoiceJour InvJTbl;
    RecordSortedList    list                = new RecordSortedList(62);
    SalesId   Id ;
    ;

     Id = "SO-0000123";
    Select InvJTbl Where InvJTbl.SalesId == Id;
    List.ins(InvJTbl);
    args = new Args(ReportStr(SalesInvoice));


    printJobSettings = new PrintJobSettings();
    printJobSettings.SetTarget(PrintMedium::Printer);
    printJobSettings.suppressScalingMessage(true);

    salesFormLetter  = new SalesFormLetter_Invoice(false);
    salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings());

    args.designName("Standard");
    args.caller(salesFormletter);
    args.parmEnum(PrintCopyOriginal::Original);
    args.parmEnumType(enumnum(PrintCopyOriginal));
    args.object(list);

    reportRun = new ReportRun(args);
    reportRun.setTarget(PrintMedium::Printer);
    reportRun.init();
    reportRun.run();
}|

Thursday, December 1, 2011

AX2012 Reporting with MVC Architecture

New AX 2012 Reporting Development model based on MVC Design Pattern?"
The short answer to this question, is Yes!.

For those that are familiar with the concepts behind MVC, or Model-View-Controller, then this is a great move in reporting. If your not that familiar with the MVC concepts, wikipedia.org has a great little stub home for this topic- http://en.wikipedia.org/wiki/Model-view-controller

"Model–view–controller (MVC) is a software architecture,[1] currently considered an architectural pattern used in software engineering. The pattern isolates "domain logic" (the application logic for the user) from the user interface (input and presentation), permitting independent development, testing and maintenance of each (separation of concerns).

Model View Controller (MVC) pattern creates applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements."
Now, lets get to the specifics for Dynamics AX 2012, around this concept and how this design pattern is applied for reporting. First off, the following will give you a high level understanding of how the MVC pattern maps to real concepts, and class frameworks in AX 2012, as well as a link to the recently released programming guide for AX 2012.: MSDN: Reporting Programming Guide [AX 2012].

Model: SrsReportDataContractUIBuilder
View: SrsReportDataContract
Controller: SrsReportRunController

Finally, you have the following which is a direct link to download the Report Programming Guide for AX 2012: [AX 2012] Report Programming Guide

For now, this is a good start, and I thought a good way to start the week. Focused on the answer to a question, with some great resource information from Microsoft. Yes, the reporting programming modeling in AX 2012 is based around MVC.

Ax2012 CU2 Released.

 Wanted to update everyone that Microsoft Dynamics AX 2012 - CU2 has been released. You can get to the download from the following location: Cumulative Update 2 for Microsoft Dynamics AX 2012

In this update several fixes are included, and the release schedule for AX 2012 is very impressive from Microsoft for updating issues. The new build number, after Cu2 is applied should be: 6.0.947.280.

There are a lot of fixes around workflow, financial dimensions, EP Time sheets, etc. etc. It's important that everyone update to this latest CU2, to help address any issues, and before contacting MS Support for new issues.

Keep in mind, that these Cumulative Updates, can be SlipStreamed for fast deployment. To find out exactly how to do this action, you can use the following post: AX 2012 - Slipstreaming a Cumulative update

That's all for now, check back soon as more to come! Till next time!

Update: Interesting fact here, if you have for example an AOS server that does not have the 32-bit client installed on it, you can not proceed with the CU2 update. So you must have the AX 2012 client installed before the axupdate.exe from CU2 will progress. Interesting point I thought everyone would like to know.

Upgrading Reports [AX 2012]

MorphX reports as well as ReportLibraries can still live within AX 2012. There is actually a process in which you have to execute that will take the metadata for the AX 2009 ReportLibraries and update them, so they can live and execute within an AX 2012 instance. That resource can be found here.: Report Project Upgrade [AX 2012]

Guidance when upgrading the report
http://technet.microsoft.com/en-us/library/gg724106.aspx