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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Dynamically Update Sum of Real Value Field as Navigating Through Lines in Grid in AX 2012 R3

(1) ShareShare
ReportReport
Posted on by 61
 Public realI have a method to calculate the total consumption cost based on a production ID:
 getTotalConsumptionCost(ProdId _prodId)
{
    ProdJournalBOM prodJournlBOM;
    real totalCost = 0;


    select sum(ConsCost) from prodJournlBOM
           where prodJournlBOM.ProdId == _prodId;

    totalCost = prodJournlBOM.ConsCost;

    return totalCost;
} 


Where should I place the logic to calculate and update line-level data based on header information in AX 2012 R3?Should this logic be placed in the header table or the lines table? 
I want to ensure that the calculated value is accurate and up-to-date for each line.
  • André Arnaud de Calavon Profile Picture
    307,719 Super User 2026 Season 2 on at
    Hi,
     
    Can you tell on what form you need the calculation and what exact tables are used as data source? What do you mean by the last two words "each line"? What lines are you referring to?
  • Fawad Ahmad Profile Picture
    61 on at

    Sorry for the late reply. Regarding the Production Order Cost Analysis customization:

    I have the following setup:

    • ProdTable in the header.
    • ProdJournalBOM in the line.

    I wrote a method in ProdJournalBOM, but the data in the field is inconsistent, whereas the calculations in the header table (ProdTable) are working correctly. How can I ensure that the line-level data accurately reflects the header information? Where should the logic to calculate and update line-level data based on header information be placed in AX 2012 R3?

  • Martin Dráb Profile Picture
    241,360 Most Valuable Professional on at
    The logic in your method has a single parameter: prod ID. Putting it at the line level makes no sense, because all lines with the same prod ID will have the same value, because they'll call the same logic with the same parameter. If you want different values for different lines with the same prod ID, it's not just about the code placement. You need to add the missing logic.
     
    If you need more help, you'll need to give us more information about your goal. We see code you have at the moment, but we don't know what code you meant to write.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 543 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 415 Super User 2026 Season 2

#3
CU-1234529-002 Profile Picture

CU-1234529-002 188

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans