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.