programming4us
 
Applications Server
 

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

2/5/2013 4:02:29 PM

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
 
 
REVIEW
 
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

- Sigma 24mm f/1.4 DG HSM Art

- Canon EF11-24mm f/4L USM

- Creative Sound Blaster Roar 2

- Alienware 17 - Dell's Alienware laptops

- Smartwatch : Wellograph

- Xiaomi Redmi 2
 
VIDEO TUTORIAL
 
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
 
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
 
Top 10
 
- How To Install Android Market & Google Apps On Kindle Fire
- How To Make Ubuntu Look Like Windows 7
- How To Add A New Account in MS Outlook 2013
- Get Android & Mac OS X Style Gadgets For Windows 7 & Windows 8 With XWidget
- How To Activate Microsoft Office 2013
- How To Install Actual Facebook App On Kindle Fire
- How To Create, View And Edit Microsoft Office Files On Kindle Fire
- Download Attractive Business PowerPoint Templates For Free At SlideHunter
- How To Use And Enable Hibernate & Sleep Mode In Windows 8
- How To Get Microsoft Office 2013 Trial Product Key From Microsoft