Tuesday, February 5, 2013

Inside Microsoft Dynamics AX 2012


Inside Microsoft Dynamics AX 2012

Thought to share these Youtube videos on Dynamics AX 2012:

Video1 - Developer Tools
- Stresses the importance of Models
- API's
- Interoperability with .Net
- 3 yrs spent by Microsoft for the new Development Tools
http://www.youtube.com/watch?v=cZc1Jya7tqM&feature=related

Video 2 - Services and AIF
- Heavy investment in Services
- Mobile applications can plug in to the service model
- 90 webservices
- Simplified and Powerful Integration
http://www.youtube.com/watch?v=sn9I6TaQY9o&feature=relmfu


Video 3 - Reporting
- Integration with Excel
http://www.youtube.com/watch?v=qx3_2oSrdpI&feature=relmfu

Video 4 - Office Integration
- Collabration across Office, AX and Visual Studio
- Demo (Budget)
http://www.youtube.com/watch?v=83Rm0Dbgb3g&feature=relmfu

Video 5 - Usability 
- End-User Simplicity
- Recruited people from the industry to test the usability scenarios
- Field Surveys
- Demo AR Customers/SO's (Fact boxes)
- Consolidate Commands into Flexible Activity based Ribbons (Similar Look and feel as Excel, Word)
- Fast tabs
- "Go to Main Table" replaced by hyperlink lookups (cool feature)
http://www.youtube.com/watch?v=CCyUcbTHuc4&feature=relmfu

Video 6 - Enterprise Portal
 - Rich UI
 - Travel Expense Demo
 - Microsoft internal adoption (aka DogFooding)
 - ISV's interested to build on new add'ons for EP
http://www.youtube.com/watch?v=Td2ROxxXzcE&feature=youtube_gdata


Video 7 - Performance
20 x times faster than 2009
- Managed X++
- Leverages Virtualization
- Leverages AppFabric
http://www.youtube.com/watch?v=YRJaMkElvqk


Video 8 - Programmability
-Improvements in X++ Language
-Improvements in Language Performance
-Visual IDE and MorphX IDE
-Attributes
-Marrying C# and X++
-X++ managed language
-AOT in VS.Net
http://www.youtube.com/watch?v=-jUtbBGTt-U


Video 9 - Security
-Improved Administration Experience for setting up Security
-Flexible Authentication (Leverages Claim Based Authentication from Sharepoint)
-Authorization
http://www.youtube.com/watch?v=EYQukrLQF7A&feature=channel_video_title


Video 10 - Simplicity
- Experiences for Developers, Administrators and End Users made simple
- For Developers - Goal to enrich .net and x++ developers experience
- Installation experience for Developer improved (Single Click Experience)
- Simplicity for System Administrators
- Good Feedback from Partner and Customer Channel
http://www.youtube.com/watch?v=-0C6t_vFyX0


Video 11 - Processes and Workflow
-Graphical workflow Editor for Business Users and Application Developers
-Leverages Wofklow Foundation of .Net 4.0
-Flexible Work Item Queues
-60 Workflow Types out of the box
-Sub-Workflows
http://www.youtube.com/watch?v=XQK1sZGkgvg


Video 12 - Organizational Model
-Model for External and Internal Reporting
-Policy Frameworks
-Reporting
http://www.youtube.com/watch?v=EteQAKqwnTU

Monday, January 14, 2013

Set not empty / not blank record in query (AX 2009)

Hi,

If we want to set not empty condition at query then following code can be used in value

SysQuery::valueNotEmptyString()

Example:

this.query().dataSourceTable(tablenum(LedgerTrans)).addRange(fieldId2Ext(fieldnum(LedgerTrans, Dimension),5)).value(SysQuery::valueNotEmptyString());

Thursday, January 10, 2013

Most commonly used Format and code while creating reports X++ report


Most commonly used  Format and code while creating reports.



public class ReportRun extends ObjectRun
{
    TransDate               fromDate;
    TransDate               toDate;
    DialogField             dialogFromDate, dialogToDate;
    DialogField             dialogLedgerAccount;
    DialogField             dialogPrintExcelReport;
    LedgerAccount           ledgerAccount;

    LedgerTrans             ledgerTrans1, ledgerTransOpenBal;
    str 50                  dimension;
    AmountMST               amount;
    AmountCur               creditAmt,debitAmt;
    AmountCur               openingBalAmt,closingBalAmt;

    #define.CurrentVersion(4)
    #localmacro.CurrentList
        FromDate,
        ToDate,
        ledgerAccount
    #endmacro
}

==================================================


public container pack()
{
    return [#CurrentVersion,#CurrentList];
}

==================================================


public boolean unpack(container _packedClass)
{
    boolean     ret;
    Version     version = RunBase::getVersion(_packedClass);
    ;

    switch (version)
    {
        case #CurrentVersion:
            [version, #CurrentList] = _packedClass;
            ret = true;
            break;

        default :
            ret = false;
    }
    return ret;
}





==================================================


public Object dialog(Object _dialog)
{
    DialogRunbase dialog = _dialog;
    ;

    dialog.addGroup("Date Range");
    dialogFromDate = dialog.addFieldValue(typeid(TransDate), fromDate,"From Date");
    dialogToDate = dialog.addFieldValue(typeid(TransDate), toDate,"To Date");
    dialogLedgerAccount = dialog.addFieldValue(typeid(AccCategory), ledgerAccount,"Ledger Account");

    return dialog;
}


==================================================


public boolean getFromDialog()
{
    ;
    fromDate = dialogFromDate.value();
    toDate   = dialogToDate.value();
    ledgerAccount = dialogLedgerAccount.value();

    return true;
}



==================================================
Fetch method --------

queryRun = new QueryRun(this);
    this.query().dataSourceTable(tablenum(LedgerTrans)).addRange(fieldnum(LedgerTrans,TransDate)).value(queryrange(fromdate,todate));

this.query().dataSourceTable(tablenum(LedgerTrans)).addRange(fieldnum(LedgerTrans,AccountNum)).value(ledgerAccount);
    this.query().dataSourceTable(tablenum(LedgerTrans)).addOrderByField(fieldId2Ext(fieldnum(LedgerTrans, Dimension),5));

//this.query().dataSourceTable(tablenum(LedgerTrans)).orderMode(OrderMode::GroupBy);
    //this.query().dataSourceTable(tablenum(LedgerTrans)).addGroupByField(fieldId2Ext(fieldnum(LedgerTrans, Dimension),5));

//this.query().dataSourceTable(tablenum(LedgerTrans)).fields().addField(fieldnum(LedgerTrans, AmountCur), SelectionField::Sum);

//query.dataSourceNo(1).fields().addField(fieldnum(CustSettlement, SettleAmountMST), SelectionField::Sum);
    //this.query().dataSourceTable(tablenum(LedgerTrans)).addRange(fieldnum(LedgerTrans,Dimension[5])).value(dimension);

//this.query().dataSourceTable(tablenum(LedgerTrans)).addRange(fieldId2Ext(fieldnum(LedgerTrans, Dimension),5)).value("Anil P Talla");

//query.dataSourceNo(2).addGroupByField(fieldId2Ext(fieldnum(CustTrans, Dimension),1));



while (queryRun.next())
    {

        ledgerTrans = queryRun.get(tablenum(LedgerTrans));
        // Add code here
    }

Thursday, December 6, 2012

Add User to admin group from SQL / back end In AX 2009



Hi All,

When your user is not having any permissions to make changes in AX and you are unable to change the permission from ax then u can try to change the user group of that user from SQL studio manager i.e. back end.

Select the database on which you have to make changes.
check the user id and information with the following queries.

Select * from USERGROUPINFO

Select * from USERGROUPLIST 
(check which is the group assigned to your user and which you need)


Here i know that the usergroup ADMIN is having all the rights so i'm adding my user to admin group

Update USERGROUPLIST set GROUPID='Admin' where USERID='Kishr'

Friday, November 30, 2012

Report with Sum at Header using Duplicated Query


Your report needs the summation of some fields at the Header portion but you do not want to hack the report classes to achieve that.
Dynamics Ax subtotal is available only at the footer. If you need it in some other section, you would have to find a way around. We will look at an approach where the report query is duplicated for the necessary calculation at the section header.
The demo subsequently will produce the report illustrated in the following figure. The section footer is the subtotal produced by the standard report. The section header on the other hand shows the output of the approach suggested.
Dynamics Ax Report with Sum at Header

Motivation

There are ways to achieve this. The use of duplicated query is motivated by the following factors.
  • It could be applied to existing report without affecting the overall structure. In other words, no changes will be required on the data source and other sections in the report.
  • The calculation is in accordance to the filters set by the user without additional work.
  • The report query will be handled by Dynamics Ax report subsystem while we will only work on the duplicated copy of the query.

Technique Highlight

Basically we will have two copy of the same query. At the section group header, we will loop the duplicated copy until the next header group is reached. The necessary work is performed while we loop and the value to be shown at the group heading is prepared prior to executing the group header. Then the report subsystem will take over and loop the original copy of the query.
The following code segment illustrates the technique explained above.
// loop as long as within the same subheading group.
do {
  custTransLoop = qrHead.get(custTransLoop.TableId);
  if (custTransLoop.AccountNum == CustTrans.AccountNum) {
    rSum += custTransLoop.AmountCur;
  }
  else {
    break//heading group changed.
  }
while (qrHead.next());

mrSum = rSum; //value prepared for heading.

super(); //execute group heading.

The following code segment illustrates how the report query is duplicated into a QueryRun object.
qrHead = new QueryRun(element.query());

Demo

We will create a simple report with CustTrans as the only data source to demonstrate the highlighted approach. We dissect the whole process into three sections. The first will cover creating report while the second is regarding adding subtotal just to verify the outcome of the calculation. The final section is the one that cover the approach recommended. Those that are well versed with Dynamics Ax reporting tool may opt to skip the first two sections.

Create Report

The following steps cover report creation. Alternatively, you may use the Report Wizard to perform this.
  1. Create a new project to group objects if you have not.
  2. Right click on your project and select New > Report. You will have a report with the name Report1 created.
  3. Right click on Data Sources > Query > Data Sources and select New Data Source. Change the Table to CustTrans under the Property Page.
  4. Expand the node CustTrans(CustTrans) and right click on the node Sorting. Select New > Field. Ensure the Field is AccountNum. Change the properties AutoHeader and AutoSum to Yes.
  5. Right click on the Designs node and select New Report Design. You will see a new node named ReportDesign1 with a child node named AutoDesignSpecs.
  6. Right click on ReportDesign1 and select Generate Design. You will see a node named Generated Design added. You will also see a node named Section Group: CustTrans too.
  7. Expand the Section Group: CustTrans and right click on Body:CustTrans_Body. Select New Control > Field Group from CustTrans. Change the field group's DataGroup property to AutoReport.

Validation preparation

The following steps add a subtotal to a field for verification.
  1. Change the AutoFieldGroupOrder property to "Save the fields' properties" for the field group.
  2. Expand the Group and find control named Real: CustTrans_AmountCur and change the SumAll property to Yes.
  3. Right click on Footer: CustTrans_Footer and select New Control > Sum. Change the properties of the newly added for Table to CustTrans and Field to AmountCur.

Sum at Header

You now have a report with subheading. The following steps demonstrate the approach mentioned earlier.
  1. Add the following declaration to classDeclaration of the report. The classDeclaration will now look like the following.
  2. public class ReportRun extends ObjectRun
    {
      AmountCurDebCred  mrSum;
      QueryRun          qrHead;
    }

  3. Add a new method to Header: CustTrans_Header and copy the following code to it.
  4. display AmountCurDebCred SumAmtCur()
    {
      return mrSum;
    }

  5. Then add a new a control with the display method to the Header. This could be done by dragging the method and dropping it at the Header: CustTrans_Header node.
  6. Override the method executeSection() of the header with the following code. The method CustTrans_Header:executeSection() shall looks like the following.
  7. public void executeSection()
    {
      CustTrans  custTransLoop;
      real       rSum;

      // dupplicate the query on first execution of the header.
      if (!qrHead) {
        qrHead = new QueryRun(element.query());
        qrHead.next();
      }

      // loop as long as within the same subheading group.
      do {
        custTransLoop = qrHead.get(custTransLoop.TableId);
        if (custTransLoop.AccountNum == CustTrans.AccountNum) {
          rSum += custTransLoop.AmountCur;
        }
        else {
          break;
        }
      } while (qrHead.next());

      mrSum = rSum; //prepare value to be shown at group header.

      super(); //execute the group header.
    }


Source :http://axassociate.blogspot.in/search?updated-max=2008-03-20T14:28:00Z&max-results=3&start=9&by-date=false

Run External Application from Dynamics Ax


Calling up external program from Dynamics Ax can be something very interesting to audience during introductory training and demo. Once in a while, I will encounter associates asking if it is possible to run external program, open word document, open a URL in an external browser, etc. from within Dynamics Ax. Usually they will show a sign of immense enthusiasm when I show them how it is achieved. It is like their imagination is exploring all sort of creative ways to make use of this facility.
The interesting part is that executing external application is fairly effortless in Dynamics Ax. X++ is capable of calling Microsoft Windows Application Programming Interface (API). The common functionalities of the Win API have been built in classes WinAPIWinAPIServerWinGDI andWinInet. Running external application could be achieved through the static method WinAPI::shellExecute.

Static Method WinAPI::shellExecute

This method takes six parameters where five of them are optional parameters. The following code segment shows the interface of this method.
client static int shellExecute(
    Filename _lpFile,
    str      _lpParameters      = '',
    str      _lpDirectory       = '',
    str      _lpOperation       = #ShellExeOpen,
    int      _show              = #SW_SHOWNORMAL,
    boolean  _waitForCompletion = false
    )

The interface might look complicated but the first parameter is usually all we need to assign. It is sufficient to achieve most of the scenarios. The second parameter allows us to execute an executable with parameters. We will look at examples where this second parameter comes into play later.

Class SysShellExecute

The class SysShellExecute facilitates calling WinAPI::shellExecute. This class has a main method that call the method WinAPI::shellExecute using args.parm() as the first parameter. This enables WinAPI::shellExecute to be called from menu item with ease. This is important Dynamics Ax bring up windows through menu item. Menu item works with buttons with ease.
The following figure shows the property dialog of a menu item using SysShellExecute. The menu item shown will open an Internet Explorer browser when executed.
SysShellExecute Menu Item Property

Opening a File or URL

You shall not encounter any issue running application with class SysShellExecute. However, I have received enquiry when it comes to opening a file or a URL. I do not want to go into the ways they have tried. Basically opening file and URL are equally simple.

1. Default Application

Windows has associated different file type to a default application. We just need to execute the file name in order to open that file with the default application. The following figure shows the property page of a menu item that opens the website Dynamics Ax Associate in the default browser.
Open URL with SysShellExecute Menu Item

2. Specific Application

The previous approach opens the file or URL in the default application. There are cases where you need to specify the application to open the file with. You may achieve this with static method WinAPI::shellExecute.
Let say the default browser for your computer is FireFox and the website you are opening requires Internet Explorer. You may use the following code to open the URL with Internet Explorer.
WinAPI::shellExecute("IEXPLORE.EXE",
    "http://axassociate.blogspot.com");

Conclusion

The examples given above cover the execution of Windows Internet Explorer and opening of URL. They work similarly with a Word Document, Excel Spreadsheet, etc.

Source : http://axassociate.blogspot.in/2008/03/run-external-application-from-dynamics.html