Skip to main content

Notifications

Announcements

No record found.

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.
  • Martin Dráb Profile Picture
    Martin Dráb 231,409 Most Valuable Professional on at
    Dynamically Update Sum of Real Value Field as Navigating Through Lines in Grid in AX 2012 R3
    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.
  • Fawad Ahmad Profile Picture
    Fawad Ahmad 61 on at
    Dynamically Update Sum of Real Value Field as Navigating Through Lines in Grid in AX 2012 R3

    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?

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,516 Super User 2025 Season 1 on at
    Dynamically Update Sum of Real Value Field as Navigating Through Lines in Grid in AX 2012 R3
    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?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans