web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

How can I divide one field with another and display it in third field?

(1) ShareShare
ReportReport
Posted on by 311
Hello!
 
I am working with a bakery at the moment, and I have a little case.
I have added two fields to the /Production Order/ table:
- /Total weight/ - sums all weights of component values on the specific Production Order
- /Dough weight/ - gets the weight of one dough specified in the Item-card
 
I want to add a third field named /Number of doughs/ that displays the number of doughs the bakery can make based on those two values.
Therefore, I want to divide the Total Weight with Dough Weight to get an estimate of how many doughs are going to be made.
 
This is the code I am working with:
 
fields
    {
        field(50100; /Number of doughs/; Integer)
        {
            // HOW CAN I DIVIDE TOTAL WEIGHT WITH DOUGH WEIGHT AND DISPLAY THE VALUE HERE?
        }
        field(50101; /Total weight/; Decimal)
        {
            FieldClass = FlowField;
            CalcFormula = sum(/Prod. Order Component/./Expected Quantity/ where(/Prod. Order No./ = field(/No./), /Routing Link Code/ = const('BAKE')));
        }
        field(50102; /Dough weight/; Decimal)
        {
            FieldClass = FlowField;
            CalcFormula = lookup(Item./Dough weight/ where(/No./ = field(/Source No./)));
        }
    }
 
Additionally, I would like to round that number up to the nearest whole number, because they always want to make a little too much than too little dough.
 
How can I achieve what I am looking for?
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    92,445 Super User 2025 Season 2 on at
    How can I divide one field with another and display it in third field?
    Hi, first of all, Flowfield does not have a Validate trigger or OnModify. And flowField cannot reference another Flowfield.
    More details:
    Dynamics 365 Business Central: A flow field is part of the query column list, this is not supported (Flowfield based on Flowfield)
     
    So you need to determine when you calculate the "Number of doughs", the simplest way is to add an action to calculate the current value. Because no matter you calculate it in the OnInsert or OnModify trigger of the Production Order table, the final value may not be the latest. Or you change "Total weight" and "Dough weight" to non-flowfield field, update these two values when Prod. Order Component and Item are updated.
     
    PS: How to get value from a FlowField field
     
    Hope this can give you some hints.
     
    Thanks.
    ZHU

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,237

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 3,425

#3
Sumit Singh Profile Picture

Sumit Singh 2,907

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans