Skip unknown fields when calculating a value in using AFSimple_Calculate

This commit is contained in:
Calixte Denizet 2022-08-03 23:40:09 +02:00
parent 8bad06f158
commit 6916fabd51
2 changed files with 4 additions and 1 deletions

View File

@ -414,6 +414,9 @@ class AForm {
const values = [];
for (const cField of cFields) {
const field = this._document.getField(cField);
if (!field) {
continue;
}
const number = this.AFMakeNumber(field.value);
if (number !== null) {
values.push(number);

View File

@ -1061,7 +1061,7 @@ describe("Scripting", function () {
value: "",
actions: {
Calculate: [
`AFSimple_Calculate("SUM", ["field1", "field2", "field3"]);`,
`AFSimple_Calculate("SUM", ["field1", "field2", "field3", "unknown"]);`,
],
},
type: "text",