Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Table Level

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

   I have 3 fields Amount,CAmount,Balance. CAmount is Flowfield . Is it possible to define Balance = Amount - CAmount at Table level.

I have written below code at Table Level but not working. Do i need to write Modify also.

CAmount - OnValidate()
"Balance Amount" := Amount - CAmount;

Thanks

*This post is locked for comments

  • Verified answer
    Olister Rumao Profile Picture
    3,959 on at
    RE: Table Level

    Try using

    Rec.CALCFIELDS("CAmount");

    Rec."Balance" := Rec."SAmount"-Rec."CAmount";

    MESSAGE('%1',"Balance");

    Rec.MODIFY;

  • Suggested answer
    Suresh Kulla Profile Picture
    47,688 on at
    RE: Table Level

    Add your code in OnInsert trigger.

  • jsshivalik Profile Picture
    3,099 on at
    RE: Table Level

    Hi

    I have written the below code on Table Modify Trigger . It displays message but does not Update balance

    OnModify()

    CALCFIELDS("CAmount");
    Balance := "SAmount" - "CAmount";
    MESSAGE('%1',"Balance");

    Thanks

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Table Level

    If it's in OnInsert or OnModify, it will update the record where you're working on.

  • jsshivalik Profile Picture
    3,099 on at
    RE: Table Level

    Hi

     Since this code is written on Table Trigger it will Update all records

    Thanks

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Table Level

    The correct code is what Mohana as suggested you:

    CALCFIELDS(CAmount);

    "Balance Amount" := Amount - CAmount;

    But you can't place that code in the CAmount - OnValidate trigger (because CAmount is a flowfield, so automatically calculated).

    The calculation must be triggered in a different place, for example in Amount - OnValidate trigger.

  • jsshivalik Profile Picture
    3,099 on at
    RE: Table Level

    Hi

     I have written like this but still not working . Do i need to write Modify also.

    Thanks

  • Verified answer
    Mohana Yadav Profile Picture
    60,228 Super User 2025 Season 1 on at
    RE: Table Level

    you have to use CALCFIELDS for flow fields before using

    CALCFIELDS(CAmount);

    "Balance Amount" := Amount - CAmount;

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans