Showing posts with label development. Show all posts
Showing posts with label development. Show all posts

Monday, January 30, 2012

Dynamics AX technical consultant interview questions


Today, I have spent quite a lot of time to gather the interview question for a Dynamics AX Technical Consultant and Developer. I have also provided the links of the answers of those question
1.      How can we create primary key for a table?

2.      what precautions you need for overriding fetch() method for a report?

3.      Difference between OCC (Optimistic concurrency control) and PCC (Pessimistic concurrency control)?

4.      How many types of MAP there in Dynamics AX?

5.      What is cache lookup what is it used for?

6.      Difference between table and views?

7.      why we use dialog? and how to accomplished it?

8.      what are the different type of index?

9.      Difference b/w cascade + restricted and restricted delete actions?

10.  In which case delete_from and delete() have same result?
Delete() will delete one record at a time.

Delete_from can delete multiple records at a time.


11.  Explain sales/purchase order processes in AX.

12.  Can you just tell the table properties that you can remember

13.  Different types of relation? Explain it detail?

14.  Explain Queries? What’s it used for?

15.  Explain different types of reports?
There are two types of reports in AX

16.  Differentiate auto design spec & Generated design? Which one is a preferable choice and why ? 



17.  What are all the add- on tools you used in Dynamics AX (It’s an indirect question for AIF)



19.  What is the default index for a table?

       Default Index in Table

20.  Did you work with EP (Enterprise Portal & Workflow) how you can implement this features into your projects ?
       EP in AX 2012

21.  Can you just point out some best practice you used when u develop a project? 

22.  Did you worked with base modules? 

There is a also a link containing a document that have hundreds of question

Sunday, January 29, 2012

migrate AX2009 reports to AX2012 Reports

There is not any tool available that automatically publicly for the migration/conversion from Morph X++ reports into the SSRS Reports and also the upgrade engine of dynamics ax does not look after the upgrade issues in those objects such as conflicts between the two versions.
“Reports are not upgraded automatically during the upgrade process. Microsoft Dynamics AX provides hundreds of default, out-of-the-box reports that you can deploy and customize. To upgrade Morph X reports, we recommend that you customize a default report. The default reports run on SQL Server Reporting Services. Reporting Services is a server-based reporting platform that provides comprehensive reporting functionality for a variety of data sources.
When upgrading to Microsoft Dynamics AX 2012, existing Reporting Services reports and reports based on the Morph X reporting framework are copied to the Microsoft Dynamics AX 2012system. However, they will not be upgraded” For Further Reading
There was a team sonata software that used a tool (created internally not released) to converts the X++ reports to the SSRS reports.

Basic guidelines for conversion
1.     All the logic that has been placed in fetch method of X++ report should be moved to RDP (Report data provider) class.
2.      Generated Design on X++ report will be replaced by Precision Design in SSRS reports.
3.      Report AOT query will remain the same in both approaches.
4.      X++ reports that do not contain any complex logic, can be done through query based report with Auto Design in SSRS reports.

Thursday, January 26, 2012

lookup in AX

In the dynamics ax 2012, there are different ways to fill the combo box/drop down list

How to create a simple lookup

The SysTableLookup class is provided by the standard application to allow programmers to easily create their own lookup forms, in code.
The basic steps to using this class are as follows:
  1. Create the sysTableLookup object
  2. Create the query to select the lookup data
  3. Add  the fields shown on the lookup
  4. Performs the lookup

client static void lookup<TableName> (FormStringControl _ctrl)
{
    SysTableLookup          sysTableLookup       =  SysTableLookup::newParameters(tableNum(<tableName>),_ctrl);
    Query                   query                = new Query();

    // create the query for the lookup
    QueryBuildDataSource    queryBuildDataSource = query.addDataSource(tableNum(<tableName>));

    // Add fields that will be shown in the lookup as columns        
    sysTableLookup.addLookupfield(fieldNum(<tableName>,<FeildName1>));
    sysTableLookup.addLookupfield(fieldNum(<tableName>,<FeildName2>));

    //Add the query to the lookup form
    sysTableLookup.parmQuery(query);

    // Perform the lookup
    sysTableLookup.performFormLookup();
}

This above method of lookup was heavily used in AX 2009, and it also used in the AX 2012 when there isn’t any data source specified in the form (i.e. Dialog Form) and the StringEdit control used for the lookup

How to create a simple lookup Reference
 
 The SysReferenceTableLookup class is used to construct lookup forms for reference controls.
  1. Create the SysReferenceTableLookup object
  2. Create the query which will be used to select the lookup data
  3. Add the fields which will be shown on the lookup
  4. Perform the lookup 
This method is now the standard method used to lookup the data for drop down when there is any modification needed to override the behavior of the functionality provided by the automatic lookup


public static client <tableName> lookup<tableName>(
    FormReferenceControl        _formReferenceControl)
{
    Query                   query;
    SysReferenceTableLookup referenceLookup;

    if (_formReferenceControl == null)
    {
        throw error(Error::missingParameter(null));
    }

    referenceLookup = SysReferenceTableLookup::newParameters(
        tableNum(<tableName>),
        _formReferenceControl,
        true);

    // create the query for the lookup form
     query.addDataSource(tableNum(<tableName>));

    // Add fields that will be shown in the lookup form as columns
    referenceLookup.addLookupfield(fieldNum(<tableName>,<FeildName1>));
    referenceLookup.addLookupfield(fieldNum(<tableName>,<FeildName2>));


    // Add the query to the lookup form
    referenceLookup.parmQuery(query);

    // Perform the lookup and return the selected record
    return referenceLookup.performFormLookup() as <tableName>;
}

 

post inventory journal using code

recently i have written a quick code to to post the invent transfer jounral


/// <summary>
/// Populates the buffer of the <c>InventJournalTable</c> table data.
/// </summary>
/// <returns>
/// Buffer of the <c>InventJournalTable</c> table.
/// </returns>
Public InventJournalTable populateInventJournalTable()
{
    InventJournalTable      journalTable;
    InventJournalTableData  journalTableData;

    journalTable.clear();
    journalTable.JournalNameId  = InventParameters::find().QuickTransferJournalNameId;
    journalTableData            = JournalTableData::newTable(journalTable);
    journalTable.JournalId      = journalTableData.nextJournalId();
    journalTable.Reservation    = ItemReservation::Automatic;
    journalTable.JournalType    = InventJournalType::Transfer;
    journalTableData.initFromJournalName(journalTableData.JournalStatic().findJournalName(journalTable.journalNameId));
    journalTable.Description    = InventDescription.valueStr();
    journalTable.insert();

    return journalTable;
}


/// <summary>
/// Populates the buffer of the <c>InventJournalTrans</c> table data.
/// </summary>
/// <param name="_InventJournalId">
/// <c>JournalId</c> of the <c>InventJournalTable</c>
/// </param>
/// <returns>
/// Buffer of the <c>InventJournalTrans</c> table.
/// </returns>
public InventJournalTrans populateInventJournalTrans(InventJournalId _InventJournalId)
{
    InventJournalTrans inventJournalTrans;
    InventDim          toInventDim;

    inventJournalTrans.JournalId      = _InventJournalId;
    inventJournalTrans.JournalType    = InventJournalType::Transfer;
    inventJournalTrans.TransDate      = systemdateget();
    inventJournalTrans.ItemId         = inventSum.ItemId;
    inventJournalTrans.Qty            = InventQty.realValue();

    // Dimensions from which the transfer performs
    inventJournalTrans.InventDimId    = inventDimLocal.inventDimId;
    inventJournalTrans.initFromInventTable(InventTable::find(inventSum.ItemId), False, False);

    // Dimensions To which the transfer performs
    toInventDim.inventSiteId         = InventSite.valueStr();
    toInventDim.InventLocationId     = InventWareHouse.valueStr();
    inventJournalTrans.ToInventDimId = InventDim::findOrCreate(toInventDim).inventDimId;
    inventJournalTrans.insert();

    return inventJournalTrans;
}

/// <summary>
/// Creates and posts the Inventory Transfer Journal.
/// </summary>
/// <remarks>
/// If there is any exception then the Inventory Journal data is deleted.
/// </remarks>
public void createAndPostJournal()
{
    InventJournalTable      inventJournalTable;
    InventJournalTrans      inventjournalTrans;
    JournalCheckPost        journalCheckPost;

    ttsbegin;

    // populates the inventJournalTable table
    inventJournalTable = element.populateInventJournalTable();

   // populates the inventJournalTrans table
    inventjournalTrans = element.populateInventJournalTrans(inventJournalTable.JournalId);

    ttsCommit;

    if (BOX::yesNo('Do you want to post the Journal ? ', DialogButton::Yes) == DialogButton::Yes)
    {
        // Call the static method to create the journal check post class
        journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);

        if(journalCheckPost.validate())
        {
            try
            {
                journalCheckPost.run();
            }
            catch
            {
                // Deletes the InventJournalTable table, the InventJournalTrans will auto delete because of the Delete actions.
                InventJournalTable.delete();
            }
        }
     }
}


Friday, January 20, 2012

install Adventure Works SQL DW

How to install Adventure Works SQL DW and Analysis Services 2005/2008 sample database and project  

Below is the link for that contains the Adventure Works DB file and the process to install the DB, that is the sample database to learn the MDX queries

Tutorial
How to Install SSAS database

code samples ax 2009


I have found a very good link for code samples of different things in dynamics AX 2009


The list of items includes

·        Code samples for Microsoft Dynamics AX

·        Reports - Generate a List of Reports in Microsoft Dynamics AX

·        EP - Data Binding

·        AIF - Calling the Customer Service in Microsoft Dynamics AX 2009

·        AIF - Calling the Vendor Service in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Creating Multi-Section Forms in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Persisting Data Using View State and Data Sets in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Customizing Lookups in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Connecting a Details Part to a Grid

·        Enterprise Portal Quick Start: Adding a Toolbar to a Grid in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Handling Exceptions in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Using Record Context in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Creating a Wizard (Tunnel) Form in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Connecting a Fact Box to a Grid in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Creating Links Based on Menu Items in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Creating and Using Proxy Classes in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Creating a Basic Form in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Creating a Basic Grid in Microsoft Dynamics AX 2009

·        Enterprise Portal Quick Start: Creating an Advanced Grid in Microsoft Dynamics AX 2009

·        Code for video How Do I: Integrate an Application Using the .NET Business Connector?

·        Code for video How Do I: Create a Custom AIF Pipeline Component?

Tuesday, January 17, 2012

EP Development in AX 2012



Today, I have watched a very good presentation (http://vimeo.com/26902748) on Enterprise portal Development in AX 2012, given by a friend Zeeshan Jafry, the presentation covered the followed points, and it is a good presentation to have a quick start
  • Basic Installation and configuration of EP
  • Add
       o A new module in EP
       o   List page in that module
       o Quick Launch in that module
       o New web part
       o New EP Page
       o New user control (Web Form, Modal Dialog Form)
                  o http://msdn.microsoft.com/en-us/library/aa855178.aspx


Enterprise Portal is one of the most attractive features of Dynamics AX 2012. Enterprise Portal for Microsoft Dynamics AX provides a Web-based application framework that allows for users to interact with data in Microsoft Dynamics AX through a Web browser

Wednesday, January 4, 2012

Verify the URL Link and the File/Folder path in AX


I have experienced to verify the URL link in AX, Currently AX don’t contains any API that validate the URL Link
I have written a method that verifies the URL
public static boolean WebPathExists(str _url)
{
    boolean                    isExists;
    System.Net.WebRequest      UrlWebReq;
    System.Net.WebResponse     UrlWebRes;

    try
    {
        // Encode the URL first before passing to the Create method
        _url = System.Web.HttpUtility::UrlPathEncode(_url);
        UrlWebReq = System.Net.WebRequest::Create(_url);
        // This is needed if secure link is access like the AX share point portal
        // This is works only for the client calls
        UrlWebReq.set_Credentials(System.Net.CredentialCache::get_DefaultCredentials());
         UrlWebRes = UrlWebReq.GetResponse();
        // if there isn't any exception in the response (passed the above line of code) then the path is  correct.
        isExists  = true;
    }
    catch
    {
        isExists = false;
    }

    return isExists;
}

To checks the existence of Windows directory/File Path, there are some methods available in AX WinAPI class

WinAPI::folderExists(_filePath)
WinAPI::fileExists(_folderPath)