Merge pull request #15271 from calixteman/null_field
Skip unknown fields when calculating a value in using AFSimple_Calculate
This commit is contained in:
commit
5ad8bbe8cb
@ -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);
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user