IT tutorials
 
Applications Server
 

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

2/5/2013 4:02:29 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

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
 
 
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
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us