Perfil de Santosh KumarSantosh Kumar Paruvella'...BlogListasLibro de visitasMás Herramientas Ayuda

Blog


18 septiembre

Dynamics Ax 2009 - EP - Framework.Portal.dll Error and Quick Solution

While working on EP (Browsing the pages) – encountered with the Unexpected ERROR.

Error: An error occurred during the processing of . Could not load file or assembly 'Microsoft.Dynamics.Framework.Portal, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Some time back also found similar kind of error in Ax client also, while deploying the pages in to the AOT

Error: Cannot add the specified assembly to the global assembly cache: Microsoft.Dynamics.Framework.Portal.dll

Then I had checked in the Windows\Assembly path, and observed that Microsoft.Dynamics.Framework.Portal.dll is missed.

Tried for copy and paste this .dll from Client\Bin folder to Windows\Assembly folder, it didn’t work.

Solution: Did the drag and drop Microsoft.Dynamics.Framework.Portal.dll from Bin folder to assembly folder.

After this drag and drop solution, EP is running without error.

11 septiembre

Tree View Control in Dynamics Ax 2009 EP

This example is for displaying the Tree View control of ASP.Net by populating the customer details, in Dynamics Ax 2009 EP.

For populating the data on the tree control, I had taken the help of Proxy methods concept in EP.  I had implemented one method on the CustTable.

public static CustTable getAllRecords()

{

    CustTable   custTable;   

    Select * from custTable where custTable.CustGroup == "20";

    return custTable;

}

The same method, I am calling in EP by using Proxy like as follows,

IAxaptaRecordAdapter adapter = Microsoft.Dynamics.Portal.Application.Proxy.CustTable.getAllRecords(this.AxSession.AxaptaAdapter);

We can get the IAxaptaRecordAdapter object in other ways also, in this application I am receiving the same by using Proxy method concept.

 

For code and design the application, find the document at the following location

http://cid-f2ec589e221a4db0.skydrive.live.com/self.aspx/.Public/Dynamics%20Ax2009%20EP/Tree%20View%20Control%20example%20in%20Dynamics%20Ax%202009%20EP.docx

Rainbow.......   Airplane 

02 septiembre

Usage of (OR) condition in Ax Query's of Ax Client and EP

In this example, I want to display the records, from Project Table for the fields ProjId and ProjName have similar values like as show in figure.

 

Here I am filtering the records which have, ProjId and Project Name is 305492-00*

 

In simple I want to achieve this

 

Selec  * from ProjTable where ProjTable.ProjId == “305492-001” ||

                        ProjTable.Name == “305492-001”;

 

 

Simple select query in Ax Client:

static void projTableJob(Args _args)

{

    ProjTable   projTable;

    ;

 

    while Select projTable where projTable.ProjId Like "305492-00*" ||

                                 projTable.Name   Like "305492-00*"

 

    {

        print projTable.Name;

    }

 

    pause;

}

 

 

Using Query Classes in Ax Client: The same query is implemented by using Query classes in Ax client

 

static void projTableJobUsingQuery(Args _args)

{

    Query                   query;

    QueryBuildDataSource    qb, qb1;

    QueryBuildRange         qbr, qbr1;

    QueryRun                qr;

    ProjTable               projTable;

    str                     myvalue = '305492-00*';

    ;

 

    query = new Query();

    qb = query.addDataSource(tablenum(ProjTable), "ProjTable");

 

    qbr = qb.addRange(fieldnum(ProjTable, ProjId));

Party// Here the OR condition is implemented.  Smile 

    qbr.value(strfmt('(%1.%2 Like "%3") || (%1.%4 Like "%5")',

                qb.name(),

                fieldstr(ProjTable, ProjId), any2str(myvalue),

                fieldstr(ProjTable, Name),  any2str(myvalue)

                ));

 

 

    qr = new QueryRun(query);

 

    while (qr.next())

    {

        projTable = qr.get(tablenum(ProjTable));

        print projtable.Name;

    }

 

    pause; 

 

}

 

The above query is implemented in Ax-2009 EP:

 

protected void Project_LookUp(object sender, AxLookupEventArgs e)

    {

 

        AxLookup lookup = e.LookupControl;

        int projTableId = TableMetadata.TableNum(this.AxSession, "ProjTable");

 

               

        //Create the lookup dataset - we will do a lookup in the Project table

        using (Proxy.SysDataSetBuilder sysDataSetBuilder = Proxy.SysDataSetBuilder.constructLookupDataSet(this.AxSession.AxaptaAdapter, TableMetadata.TableNum(this.AxSession, "ProjTable")))

        {

 

            // Set the run time generated data set as the lookup data set

            lookup.LookupDataSet = new DataSet(this.AxSession, sysDataSetBuilder.toDataSet());

        }

        lookup.LookupDataSet.Init();

 

        using (Proxy.Query query = lookup.LookupDataSet.DataSetViews[0].MasterDataSource.query())

        {

            using (Proxy.QueryBuildDataSource dataSource = query.dataSourceName("ProjTable"))

            {

               

                TableMetadata projTableMetadata = MetadataCache.GetTableMetadata(this.AxSession, projTableId);

 

                TableDataFieldMetadata custAccountField =

                    (TableDataFieldMetadata)projTableMetadata.Fields.GetByName("ProjId");

 

                TableDataFieldMetadata nameField =

                    (TableDataFieldMetadata)projTableMetadata.Fields.GetByName("Name");

 

Party// Here the OR condition is implemented.  Smile       

 

                String myValue = String.Format("((({0}.{1}) Like \"{3}\")) || (({0}.{2}) Like \"{3}\")))",

                                                projTableMetadata.ToString(),

                                                custAccountField.Name,

                                                nameField.Name,

                                                (string)SearchClient.Text.ToString());

 

                using (Proxy.QueryBuildRange range = dataSource.addRange(custAccountField.FieldId))

                {

                    range.status = (int)Proxy.RangeStatus.Open;

                    range.value = myValue;                  

                }

            }

        }

 

        // Specify the lookup fields used

 

        lookup.Fields.Add(AxBoundFieldFactory.Create(this.AxSession, lookup.LookupDataSetViewMetadata.ViewFields["ProjId"]));

        lookup.Fields.Add(AxBoundFieldFactory.Create(this.AxSession, lookup.LookupDataSetViewMetadata.ViewFields["Name"]));

 

        // Specify the select field

        lookup.SelectField = "ProjId";

 

        lookup.DefaultLookupGrid.ShowFilter = false;

        

       

    }

 

 

Note: Here I am using Like Operator instead of ==.

If we want to search the records by using wild characters (*,?), it’s suggested to use Like operator instead of ==, while working with Query classes.

 

Custom Lookups In Dynamics Ax 2009-EP

In this example, Customer Lookup is customized in EP using Query classes, as similar to Ax Client.

This lookup is customized without using any Dataset.

 lookup is based on the Customer account number. 

To get a quick idea about this functionality, see the following figure.

For code and design the application, find the document at the following location

http://cid-f2ec589e221a4db0.skydrive.live.com/self.aspx/.Public/Dynamics%20Ax2009%20EP/Usage%20of%20Query%20Objects%20in%20EP.docx

We can filter the data, simply using grid filters, but this article is mainly to focus on the customization of standard lookup’s according to certain condition.

From this article, we can get an idea about how we can filter the standard lookups in EP

... Smile