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, ...
Answered

What is wrong with my Computed Column in Data Entity

(0) ShareShare
ReportReport
Posted on by

Hi all,

Need some advice on my custom Data Entity, whereby it is Build successfully, but when use it to Export, it has error processing message.

Firstly, I create a custom Data Entity with source is Sales Line, then added these computed field :

 public static server str displayLineAmt1()
    {
        
        return SysComputedColumn::multiply(
            SysComputedColumn::returnField(tableStr(M_SOLineEntity), identifierStr(SalesLine), fieldStr(SalesLine, SalesPrice)),
            SysComputedColumn::returnField(tableStr(M_SOLineEntity), identifierStr(SalesLine), fieldStr(SalesLine, SalesQty))
            );

    }

and

 public static server str displayLineAmt2()
    {
        M_SOLineEntity  mSOLine;
        SalesLine   SalesLine;

        select SalesLine where SalesLine.SalesId == mSOLine.SalesOrder && SalesLine.ItemId == mSOLine.ItemId;

        return int2Str(SalesLine.SalesPrice * SalesLine.SalesQty);
    }

 

My intention of building these 2 similar result is for learning only. For the 1st one, the approach is from Microsoft, but the 2nd one I saw from someone blog. 

Also is it true, if we want to export Data Entity with calculated column, we should Skip Staging ? how about Virtual field ?

Thanks,

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    The second method is not correct. Please check the answers in your other question, there we explained the difference between a computed column and a display method.

  • Verified answer
    vinitgoyal2005 Profile Picture
    6,332 on at

    Hi,

    2nd one is the display method and not a method for the computed column, you cannot use that as a computed column.

  • Verified answer
    Jeremy_Mounet Profile Picture
    170 on at

    Hi

    The two methods are completely different :

    First is a computed column for a View (as explain in the thread community.dynamics.com/.../1081185

    This method will calculate an amount for every row of the view.

    Second is a static method  to calculate an amount in X++. It is a static method so running without any context (no parameters) so I don't understand exactly its result.

    What do you want to perform exactly ? Compare virtual field and calculated field in a data entity ? If yes, try to parse standard dataentity through the AOT or Views to compare the two kind of implementation.

    It is globally different on the execution (SQL vs X++ execution).

    Jérémy.

  • Verified answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    These are two different methods which will use for separate implementations, 1st method is for computed column which should work fine in your case. 2nd method can not be linked to any data entity field as this is a display method and it is recommended to keep display methods at table level but again depends on the implementation.

    Are you trying to compare virtual fields with computed columns?

    The best explanation is here docs.microsoft.com/.../data-entity-computed-columns-virtual-fields at least I have found it very useful always.

  • Community Member Profile Picture
    on at

    Hi all,

    Yes, understood now.

    Anyway for the 2nd method, I get it from this blog :

    shyamkannadasan.blogspot.com/.../data-entity-in-ax7-with-computed-and.html

    ..probably it was meant for something else. I will use the 1st one, as describe from you all.

    thanks,

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 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans