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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to call display method in view computed column in D365FO

(2) ShareShare
ReportReport
Posted on by 230
Hi Team,
 
Please let me know how to call table display method in view computed column.
 
 private static server str getAmount()
 {
     str amount;

     amount = SysComputedColumn::returnField(tablestr(ABC_SalesInvoiceLinesListView), tableStr(InventTrans), tableMethodStr(InventTrans, lineAmount));

     return amount;
 }
I have use the above code but i am getting the sync error.
Categories:
I have the same question (0)
  • Suggested answer
    Saalim Ansari Profile Picture
    666 on at

    Hii,

    In D365FO, you cannot directly use a display method from a table in a view’s computed column. This is because display methods are written in X++ and executed on the application layer, whereas views are executed in SQL Server, which cannot interpret X++ code.

    As a result, display methods are not SQL translatable and cannot be used inside computed columns of views. The correct approach is to replicate the logic of the display method using SQL compatible functions provided by the SysComputedColumn class

    You need to create a static server method in the view that returns a SQL expression using functions like SysComputedColumn::returnField() to fetch fields, SysComputedColumn::if() for conditional logic, and arithmetic functions like multiply(), add(), or divide() as needed. This static method is then assigned to the computed column in the view. Essentially, instead of calling the display method, you reproduce its logic in a way that SQL Server understands. This ensures that the view compiles and runs correctly without any runtime issues.

     

    Sample code:

    private static server str remainAmountCur()
    {
        return SysComputedColumn::subtract(
            SysComputedColumn::returnField(tableStr(DT_CustTransView), identifierStr(CustTrans), fieldStr(CustTrans, AmountCur)),
            SysComputedColumn::returnField(tableStr(DT_CustTransView), identifierStr(CustTrans), fieldStr(CustTrans, SettleAmountCur))
        );
    }

    Let
    me know if you'd like help converting a specific display method into a computed column.
     

    Hope this helps
    Saalim

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans