Merge pull request #15271 from calixteman/null_field

Skip unknown fields when calculating a value in using AFSimple_Calculate
This commit is contained in:
Jonas Jenwald 2022-08-04 10:11:46 +02:00 committed by GitHub
commit 5ad8bbe8cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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",