End of mainstream support for Microsoft Dynamics AX 2009, 2012, and 2012Mainstream support for Dynamics AX 2009 Service Pack 1 (SP1), Dynamics AX 2012, and Dynamics AX 2012 R2 ended Oct. 9, 2018. After that date, only security hotfixes will be provided for these three versions through the extended support period that until Oct. 12, 2021. Read more
Dynamics 365 2019 release wave 2 plan Discover the latest updates to Dynamics 365.Release Plan | Weekly Deployment Notes
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants.Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements.
ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
How can I show the Sum of a field row of a Grid on a form, just below the field. That is summarized value.
I am Referring this two documents but not very clear about On which control and where I should write code. http://dev.goshoom.net/en/2015/11/summarized-values-in-ax-form/ www.agrinei.com/.../gridviewhelper_en.htm
The first blog is quite clear. Create a new method called updateTotal on your form, and call it from executeQuery method of the data source that you use in the grid.
Your summarized field(s) is/are updated from the updateTotal method each time it executes.
Does this help you forward?
Actually I have a problem in design part. Do I have to take a new control to show the summed values below the grid. If yes then which control I have to use and how can I like it with the code.
I have similar requirements few days back and had implemented using the link you shared(Martin's blog).
You need to have all total controls ( in your case its 6) and write a new method on form similar to method on above link which basically build the query by sum and put the values into your total controls and then you will be calling this method on executeQuery of your datasource.
I'm not sure what problem you facing . Would be better if you share something more about your problem.
Just add a new Group under your grid, and add 6 unbound real controls in it. Set property "Columns: 6" for your group and you should see the fields side by side.
Set property AutoDeclaration: Yes for all your fields. Then you can set values to these fields from updateTotal method like you see in the example in Martin's blog.
One more thing which is required is
As soon as the data entered in a grid of a form, it should also reflect in the sum of the grid row in the real control. Where and what should be the code to refresh the real control each time when the form is hit by user.
That's why you are calling this method in executeQuery() so when form open by user these controls gets the value. But if you want to update total values when you creating record on form ( on writing) call updateTotal() method on datasource write method after super call.
I have written code to call updateTotal() on datasource<write() . But its not working.
It should update the totals when a record is saved. Does it not do that? What does it do?
Did you place your code after the super call?
Its doing that but I want to update total values as soon as the record is entered in the grid on form. ( while writing the record on the form).
Basically total record control reflect with sudden change in the grid value of a field.
The UpdateTotals calculation is based on the data in the database, therefore it can't take your new record (which is not yet in the database) into account when calculating.
But you can enhance the method to take into account also non-inserted record, and call the method whenever a field is modified (override the modified method of your data source field). But this would work only when you create a new record, it would not work when you update an existing record.
if (myDataSourceTable.RecId == 0)
myTotal1Value += myDataSourceTable.MyField1;
You can even further enhance it so that the existing UpdateTotals calculation query would always skip the current active record (add a range to exclude the record that has MyDataSourceTable.RecId), and calculate the values from current active record separately into the summed values. This way you can always refresh the totals directly after the user has changed a field in the active record.
In general this is not how the totals fields in the system work, but you can do it as you like.
Business Applications communities