Linkedin Profile

https://www.linkedin.com/in/hafiz-usama-a2111195
Showing posts with label Dynamics AX. Show all posts
Showing posts with label Dynamics AX. Show all posts

Wednesday, 19 April 2017

Get old value of AX table Field

Hello Folks,

Hope y'all are doing well.

I was working on a requirement where I had to use previous value of a column.
For Example there are 2 columns in table Coulmn1 (Editable) and Coulmn2 (Non Editable). 

And, Column2 = Column2 + Column1.

Lets discuss a scenario, Column1 = 0 and Column2 = 5
we edit Column1, Now :Column1 = 5 and Column2 = 10
lets edit it one more time: Column1 = 10 and Column2 = 20 which is wrong, it should be 15.

I needed previous value of Column1 so I can subtract it from Column2 to get original Value of Coulmn2. For this, there is a method named 'orig'. I used it in modified Field Method and Implemented it like this
tableBuffer.Column2 = (tableBuffer.Orig().Column1 - tableBuffer.Column2) //returned original //C1 Value + tableBuffer.Column1;

Keep DAXing.