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)

edit method modifier

(1) ShareShare
ReportReport
Posted on by 3,542

I am struggling with the edit method modifier. Yes, I have read a lot of related articles.

In module XYZ we use a lot of EDT String (Memo) fields. I understand it is detrimental to performance to store memo's in a general table - it should be stored separately.

To accomplish this in a general sense I have a created a table XYZMemoTable with fields ParentTableId, ParentRecId and Memo. Whether this is the correct method is not the reason for this post.

So if we have a table XYZTest with field Title and an edit method getsetMemo I can store a memo in XYZMemoTable for every record in XYZTest (or any other table) and then retrieve and update this data through edit method getsetMemo.

That is where my problem comes in. Roughly my method (on the table that "has" the memo, in this case XYZTest) looks like this:

public edit XYZMemo getsetMemo(Boolean _changed, XYZMemo _memo)

{

if (_changed)

{

findorcreate XYZMemoTable record

update record with  _memo

return record.Memo

}

else

{

find XYZMemoTable record

return record.Memo

}

}

1) The first thing that confuses me is that my method gets called up to seven times if I edit a record in XYZTest. Why does AX do this? (I encountered this previously in debugging a contract class - the parm methods get called more times than Abraham had children). I don't understand the logic behind doing the same thing multiple times.

2) I cant find a similar example in AX code (an  edit method updating and inserting in another table, not just calculations). Is there one I an look at?

3) Am I entirely on the wrong track? Still new, so I'm a bit unsure.

I can supply more info if need

Thanks for reading.

*This post is locked for comments

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

    Hi Pete Alberts ,

    If you will do cross references for "Notes" EDT you will find it in multiple tables in standard AX, so I don't know why you think that it should be stored separately?  Especially if it is going to be always populated you will have to do extra join to get this data from DB.

    edit and display methods are called multiple time and that is a well know issue, thats why generally you need to avoid them. Standard way to reduce performance impact is caching, you can wrap you method with SysClientCacheDataMethodAttribute to reduce number of call.

    Or in your case you can remove edit method at all and instead add new datasource to the form.

  • Pete Alberts Profile Picture
    3,542 on at

    Thanks for the reply

    This is not where I initially read it, but here is another post on the performance issues: https://community.dynamics.com/ax/f/33/t/127833 and then the link Martin Drab posted: https://blogs.msdn.microsoft.com/emeadaxsupport/2008/11/03/performance-memontext-fields/

    With Cross Reference do you mean I should use "Find References"? I did that and the first one I looked at was custInvoiceTrans method getDocuRefNote(), which retrieves a note from DocuRef. At first glance this look like something similar to what I'm doing.

    Do you have a reference for the "avoiding display and edit methods"? I'll try the cache thing.

    But in general I understand your response is that it is not necessary to store memo's in a separate table?

  • Pete Alberts Profile Picture
    3,542 on at

    Will it be acceptable to use FK relation to the MemoTable? (And then disable lookup.)

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    DocuRef is a bit different, it's a sort of framework that allows you to add a note to any table, that's why it is done in a separate table.

    Article you referring clearly says that "Unecessarily selecting memos" cause perf issues and means that adding a memo you will increase record size, less records on a page - more reads from DB and so on and so forth. And it's true if you don't need this memo with each select you do, however, if you need this value adding it to the table is the best way, otherwise you have to do sub select to retrieve it and it will be slower.

    So there is no black and white and you need to think about each scenario and analyze it.

    Coming back to display method, here is a good blog post explaining different ways to do it community.dynamics.com/.../tutorial-caching-display-methods

  • Pete Alberts Profile Picture
    3,542 on at

    Thanks man. Your posts were very helpful and much appreciated.

    I will go back to adding the notes on the table it belongs.

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