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?