Using Computed Columns in Microsoft Dynamics AX 2012

by | Updated August 15, 2016 | Development, Dynamics AX

One of the complaints I hear most from customers is the inability to filter & sort on display methods. We have the ability in AX 2012 to use Computed Columns to add computed values to a view, and the interesting part is that these columns do support sorting and filtering. There are a few very good blogs online already showing examples of using computed columns with Sum() and other aggregate functions, but the intention here is to explore the possibility of having a computed column that is in itself a Select statement.

This example assumes the reader has knowledge of Views in AX. There is also a walkthrough on MSDN showing how to add a Computed Column to a View.

Walkthrough: Add a Computed Column to a View [AX 2012]

My view has only CustTable as its DataSource. The AccountNum field will be displayed, and the Name field is my Computed Column.

Computed Column Example

Note that the properties on the Computed Columninclude a ViewMethod property. The getName static method is as follows…

static server str getName()
return SysComputedColumn::getDirPartyNameFromParty(tableStr(CustView),identifierStr(CustTable),fieldStr(CustTable,Party));

(Note: The hard-coding in this example is intentional. I believe it helps to make the concept easier to understand for those who are new to it.)
I have created a new method in the SysComputedColumns class to return the Select statement which will be executed on SQL Server.

public static server str getDirPartyNameFromParty(TableName _viewName,
str _DataSourceParty,
str _DataSourcePartyField)
str expression;
expression = ‘select name from dirpartytable where recid = ‘ +

return expression;

SysComputedColumns has many built-in methods we can use as well, like the ReturnField method which here returns the value from the Party field in our CustView.

The resulting view looks like this, and notice I have clicked on the Name column to sort in Name order!

Table Browser
Finally, I am not advocating the use of computed columns to replace display methods under normal circumstances. However, sometimes our customers have business needs that require us to use whatever tools we have at our disposal. The possibilities here are intriguing but also dangerous. Think about how your views might be impacted by upgrades for one thing. With great power comes great responsibility!

For additional tips check out my post: More on Using Views in Dynamics AX 2012

Related Posts

  • Since the release of Microsoft Dynamics 365, there have been a lot of rumors around when Microsoft support for Dynamics AX 2009 and Dynamics AX 2012 will end. Microsoft Dynamics AX support…

  • This post is meant especially for new users of Microsoft Dynamics AX. I think it is important to be aware of different shortcuts that are available to help your speed and ease…

  • Have you ever found yourself applying the same filter to a list page in Microsoft Dynamics AX 2012 over and over? If so, this quick and easy tip will save…

1 Comment

  1. srikanth konda

    Great post Laura. Thanks


  1. More on Using Views in Microsoft Dynamics AX 2012 | Stoneridge Software Inc - […] a follow up to my last blog, Using Computed Columns in AX 2012 , I wanted to share a few more…

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events


01sep10:00 am10:30 amEnsuring Quality and Compliance for Batch Manufacturers in Life Sciences

01sep12:00 pm12:30 pmIs it Worth It to Move to the Cloud? A Look at Considerations for Current Agribusinesses Using Dynamics GP

01sep2:00 pm2:45 pmWhat’s New in Dynamics 365 Finance and Supply Chain

09sep11:00 am12:00 pmConfab Live with Stoneridge – Data Strategy and Reporting – Mining Decision Making Insights

15sep10:00 am11:00 amSolving the Biggest Challenges in Agribusiness Through Innovation and Technology

22sep12:00 am12:30 pmSimplifying Payroll and HR Management with ADP Workforce Now

22sep10:00 am10:30 amStreamlining Batch Manufacturing with Technology

22sep2:00 pm2:30 pmProcess Automation for Microsoft Dynamics D365 for Business Central, Finance and Operations and GP

23sep11:00 am12:00 pmConfab LIVE with Stoneridge - Riding the Wave 2 Release – Key Features Coming to Dynamics 365 this October

27sep(sep 27)9:00 am15oct(oct 15)11:00 amDynamics 365 Finance & Supply Chain Development Training - Online Workshop

29sep10:00 am11:00 amTop Five Reasons Why NOW is the Right Time to Move from Salesforce to Dynamics 365 Customer Engagement

29sep12:00 pm12:45 pmUnderstanding Job Costing and Tax Management in Business Central

29sep2:00 pm3:00 pmDigitalizing Horticulture & Agriculture - How to Sell Plants Online and Simplify Business Management

30sep12:00 pm4:00 pmSecurity and Permissions Training for D365 Business Central or Dynamics NAV


27sep(sep 27)9:00 am15oct(oct 15)11:00 amDynamics 365 Finance & Supply Chain Development Training - Online Workshop

06oct10:00 am10:30 amPreview of D365 Business Central Fall Release Features and Functionality

06oct12:00 pm12:30 pmInsider's Guide to New Features Available in the Fall Release of D365 Finance and Supply Chain

07oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Technical

21oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Functional

26oct(oct 26)9:00 am28(oct 28)5:00 pmStoneridge Connect Leadership and Community Conference

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!