I have a BAQ with a subquery with the expression
sum(JobMtl.TotalCost/JobHead.ProdQty)
The displayed fields are:
So what exactly is going on to calculate the Calculated_MtlCost field?
I assume the Group by By on Company and JobNum limit the sum to records with common values for those fields.
Anyway … I’m running into when this BAQ is run when a Job is created, but no demand added (ie. no Prod Qty). Which gives me a div by zero error.
Can an expression like
sum(JobMtl.TotalCost/(case when JobHead.ProdQty = 0 then 1 else JobHead.ProdQty end))
be used?
In embedded programming (where most decimals were rounded anyway), I’d just us
sum(JobMtl.TotalCost / (JobHead.ProdQty+ 0.0000001) )