web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

how to view result of existing methods in computed columns

(1) ShareShare
ReportReport
Posted on by

Hey there,

I try to get only the result of different methods into a view, that SQL can read. I read about calculated columns and it should do the trick, but I don't exactly know how.

I see that the SysComputedColumn has a lot of possibilities to engineer the calculations yourself, however, we have many calculations added to different tables, and I rather not want to reverse-engineer them.

For example, if I take one of the tables (self-created, so not standard AX) I want to create a view from we have the following method getNetAmount:

display PMENetAmount getNetAmount(PMGCurrDate _curDate = systemDateGet())
{
PMCContractPricesCalcTotals contractPricesCalcTotals;
;

contractPricesCalcTotals = PMCContractPricesCalcTotals::construct();
contractPricesCalcTotals.parmContractId(this.ContractId);
contractPricesCalcTotals.parmReferenceDay(_curDate);
contractPricesCalcTotals.calcContractPriceTotals();

return contractPricesCalcTotals.getNetAmountExclTax();
}

It doesn't even show the calculation yet, but is there a way to show what this function returns, into a string in a computed column? Instead of re-creating the entire method?

Thanks in advance,

Igor

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hi idspmax,

    Simple answer is "No". Computed column should return select statement that then will be used to build SQL view. SysComputedColumn is a helper class that helps you to build a string with SQL statements.

    PMCContractPricesCalcTotals could have complex logic behind to do multiple selects and calculations. Computed column statement is a simple sub select, something like "SELECT AccountNum From CustTable", so you should be able to do all the calculation using SQL.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans