Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)
Suggested answer

How to calculate the sum of 2 fields in my sales order?

(0) ShareShare
ReportReport
Posted on by 450

So i've created a field in my sales order of type decimal.

I want to have the sum of that field and the "Qty. to ship" field on that row. Now i looked into calcsums but i can't seem to figure out on how to use this.

After I want to check if the value is greater than the "Quantity" field.

Is there a way to accomplish this in AL code?

EDIT:

I found out that the fields are flowfields so that i need to calculate the value of a flowfield using Rec.CalcFields(Amount, "Qty. to ship") for example. Now the only problem i have now when i perform this action on this field it gives me an error that the amound field in the sales line must be a flowfield...

Any help is welcome

*This post is locked for comments

  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    13,777 Moderator on at
    RE: How to calculate the sum of 2 fields in my sales order?

    You can only do calcfield if your field is a flowfield. Amount and Qty. to ship are not flow field. Just normal field.

    You can do CALCSUM only if the field is specified as SumIndexFields in the table (Sales Line) table. Amount should be listed as SumIndexFields, but I don't think "Qty. to ship" is listed.

    Check this for reference.

    docs.microsoft.com/.../calcsums-function--record-

    Or just do the old fashion way. Do a loop and sum it manually.

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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
EH-09052238-0 Profile Picture

EH-09052238-0 1

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 1

Featured topics

Product updates

Dynamics 365 release plans