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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

.

(0) ShareShare
ReportReport
Posted on by 141

.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    BrandonSA Profile Picture
    1,673 on at

    Hi

    Couple of comments and questions

    - use 'public display' and not 'display public'

    - is number3 a field on the table?

    If so, you need a method or process that updates number3 with this.number3 = this.number1 - this.number2;

    if number3 is not a table field, then your method is generally correct. Are you getting a compile error or a run time error? WHat is the error?

    Thanks

  • RainChong Profile Picture
    141 on at

    Hi dude, number3 field is my customized field which I just added inside the table. I want it make some calculation but still couldnt get value

  • RainChong Profile Picture
    141 on at

    and also im using the method to do but still couldnt get the value.
    No error actually just Im still cant get the value.

  • Suggested answer
    BrandonSA Profile Picture
    1,673 on at

    Can you post some of the code you're trying to use? The method you've got here is a display method, which displays existing data; it isn't used to set data.

    You need code somewhere that looks something like:

    AAA myTable;
    
    ttsbegin;
    
    select firstonly forupdate myTable
       where myTable.Field1 == 'blah';
    mytable.Numner3 = myTable.Muner1 - myTable.number2;
    myTable.update();
    ttscommit;


    OR

    AAA myTable;
    
    myTable.initValue();
    myTable.Numer1 = 1;
    
    myTable.Numner2 = 2;
    myTable.Number3 = myTable.Number1 - myTable.Number2;
    myTable.insert();


  • Suggested answer
    BrandonSA Profile Picture
    1,673 on at

    Or if you want to use a method, you could do it like this:

    public void updateNumber3()
    {
       this.number3 = this.number1 - this.number2;
    }
    
    
    
    
    AAA myTable;
    
    
    select firstonly forupdate myTable;
    
    ttsbegin;
    myTable.updateNumber3();
    
    myTable.update();
    
    ttscommit;


    Of course, depending on your requirements, you could move the ttsbegin/ttscommit and update() call into the method.

    All depends on your requirement

  • RainChong Profile Picture
    141 on at

    actually it isnt a existing data. Just i use display is to show on the table. in the number3 field is empty.  no existing data.

    number3 is added by myself

  • RainChong Profile Picture
    141 on at

    number1 (is display with existing data) - number2 (is display with existing data) = number3 (non display without existing data customized by myself)

  • Martin Dráb Profile Picture
    239,178 Most Valuable Professional on at

    What did you find when debugging your code before giving up and asking here? Is your display method called at all? The code look fine to me, therefore I suspect you're not using the display method correctly.

  • RainChong Profile Picture
    141 on at

    Im doing wrong there. number3 field isnt a display method but I wrote display method. its actually

    number1 (is display with existing data) - number2 (is display with existing data) = number3 (non display without existing data customized by myself)

  • Suggested answer
    Martin Dráb Profile Picture
    239,178 Most Valuable Professional on at

    There is a display method in your very first post (methodName1()) and you said "in the method I did something but couldn't work at all". If you mean that the method work flawlessly, but you don't know how to assign the return value to a field, you should have said that.

    The answer is simple: myTable.Number3 = myTable.methodName1().

    By the way, what's the point of saving such an easily calculated value to a field? It sounds like a wrong design, unless you have a good reason for that.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans