diff --git a/packages/core/database/src/fields/formula-field.ts b/packages/core/database/src/fields/formula-field.ts index 342392a0b..db56bc7f2 100644 --- a/packages/core/database/src/fields/formula-field.ts +++ b/packages/core/database/src/fields/formula-field.ts @@ -40,7 +40,7 @@ export class FormulaField extends Field { ); } } - } + }; caculateField = async (instance) => { const { expression, name } = this.options; @@ -50,10 +50,10 @@ export class FormulaField extends Field { result = math.evaluate(expression, scope); result = math.round(result, 9); } catch {} - if (result) { + if (result === 0 || result) { instance.set(name, result); } - } + }; updateFieldData = async (instance, { transaction }) => { if (this.collection.name === instance.collectionName && instance.name === this.options.name) { @@ -80,7 +80,7 @@ export class FormulaField extends Field { ); } } - } + }; bind() { super.bind();