IT tutorials
 
Applications Server
 

Microsoft Dynamics Ax 2009 : Programming Enterprise Portal Controls (part 2) - Data, Metadata

2/5/2013 4:02:29 PM
- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire

Data

The Enterprise Portal ASP.NET controls access and manipulate data through data binding to AxDataSource. You can also access the data through the APIs directly. The Microsoft.Dynamics.Framework.Data.Ax namespace contains several classes that work together to retrieve data.

For example, use the following code to get the current row from the DataSetView.

private DataSetViewRow CurrentRow
    {
        get
        {
            try
            {
                DataSetView dsv = this.ContactInfoDS.GetDataSet().DataSetViews[this.
ContactInfoGrid.DataMember];
                return (dsv == null) ? null : dsv.GetCurrent();
            }
            // CurrentRow on the dataset throws exception in empty data scenarios
            catch (System.Exception)
            {
                return null;
            }
        }
    }

					  


To set the menu item with the current records context, use the following code.

...
...
DataSetViewRow currentContact = this.dsEPVendTableInfo.GetDataSourceView(gridConatcts.
DataMember).DataSetView.
GetCurrent();
     using (IAxaptaRecordAdapter contactPersonRecord = currentContact.GetRecord())
                {
   ((AxUrlMenuItem)e.MenuItem).MenuItemContext = AxTableContext.Create(AxTableDataKey.
Create(this.BaseWebpart.Session, contactPersonRecord, null));
                }

					  


Metadata

The Enterprise Portal framework provides a rich set of APIs to access the metadata from the AOT in managed code. The Microsoft.Dynamics.Framework.Metadata.Ax namespace contains several classes that work together to retrieve metadata from the AOT. Enterprise Portal controls use the metadata for retrieving formatting, validation, security, and other information from the AOT and apply it on the Web user interface automatically. Developers can also use these APIs to retrieve the metadata in their user interface logic.

MetadataCache is the main entry point to accessing metadata and provides static methods. For example, to get the EnumMetadata, you use MetadataCache.GetEnumMetadata, as shown here.

/// <summary>
/// Loads the dropdown with the Enum values.
/// </summary>
private void LoadDropdownList()
    {
   EnumMetadata salesUpdateEnum = MetadataCache.GetEnumMetadata(this.AxSession,
EnumMetadata.EnumNum(this.AxSession, "SalesUpdate"));
        foreach (EnumEntryMetadata entry in salesUpdateEnum.EnumEntries)
        {
   ddlSelectionUpdate.Items.Add(new ListItem(entry.GetLabel(this.AxSession), entry.
Value.ToString()));
        }
    }

					  


To get the label value for a table field, use the following code.

...
...
TableMetadata tableSalesQuotationBasketLine = MetadataCache.GetTableMetadata(
                            this.AxSession, "CustTable");
TableFieldMetadata fieldItemMetadata = tableSalesQuotationBasketLine.FindDataField-
("AccountNum");
String s = fieldItemMetadata.GetLabel(this.AxSession);
...
...

					  


Figure 1 shows some key object access hierarchy for metadata. Not all APIs are included in this figure.

Figure 1. Metadata object hierarchy
 
Others
 
- Microsoft Dynamics Ax 2009 : Programming Enterprise Portal Controls (part 1) - AJAX, Session, Context
- Microsoft Dynamics GP 2010 : Speeding up month-end processing with Reconcile to GL functionality
- Microsoft Dynamics GP 2010 : Getting control of printing with Named Printers
- Microsoft Dynamics GP 2010 : Speeding up entry by Copying a Purchase Order
- BizTalk Server 2009 : Handling Ordered Delivery
- BizTalk Server 2009 : Implementing Dynamic Parallel Orchestrations
- SharePoint 2010 : Service Applications - Managing service application associations
- SharePoint 2010 : Service Applications - Creating a custom service application proxy group
- SharePoint 2010 : Service Applications - Creating custom security for a service
- Microsoft Dynamic GP 2010 : Dynamics GP System - Additional setup considerations
 
25 Inspiring Game of Thrones Quotes
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS