Report With Calculated Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blueprint
    Active Community Member
    • Jan 2019
    • 223

    Report With Calculated Field

    I have an entity called `Part` which represents an item from our inventory.

    Against this entity, I have a field called `PhysicalStock` which is a calculated field done in the `entityDefs` metadata and is also marked as `notStorable`. I have another entity called `Stock` which is linked multiply to a Part and allows many stock adjustments to be added for each inventory part item.

    However, I'm now trying to generate a Report with a filter where PhysicalStock is greater than zero - sadly, it doesn't work and nothing is shown. If I view the Part entities in a list, the PhysicalStock column is computed correctly and the stock levels are shown. My guess is that it is related to the point at which the field is computed.

    I guess my question is: what is the lowest level within EspoCRM where I could compute the PhysicalStock field where it could be used correctly in features such as a Report? Is there any way of getting MySQL to generate a computed field and allow EspoCRM to load it directly as if it were any other field type?

    I really don't want to make this PhysicalStock field not `notStorable` as it should always be computed (even though it may slow down the system). Can anyone suggest a better way of achieving such a computed field value?
    Last edited by blueprint; 01-29-2020, 10:20 PM.
Working...