Copy link to clipboard
Copied
I'm a newbie and need some help. I have a form and need to calculate six fields. The problem is that there is one text field between the 4th and 5th number. I tried the following using simplified field notation but it wouldn't work. The attached photo shows the section of the form.
1_Amount + 2_amount + 3_Amount + 4_Amount + 5_Amount + 6_Amount
.
Sorry guys, but on this one discussion I will have to disagree.
It is not necessary to rename all of your fields as suggested by Try67 nor use the "Value is" method as suggested by NesaNurani.
You can perfectly use the Simplified Field Notation method as long as you escape the numerical character and the special characters. This has been answered before in the forums.
As mentioned by Try67, you will run into problems because using a number as the first charachter in your field names (and then a
...I forgot to add that escaping special characters when using Simplified Field Notation is explained in more detail in Chapter 4 of the Acrobat JavaScript Scripting Guide, " Using Acrobat JavaScript in Forms-Creating simple JavaScripts", page 57.
And here's the quote with the correct explanation:
The simplifed field notation makes it very easy to define relatively complex calculations.
Instead of typing:
event.value = ( getField("income.interest").value
+ getField("income.rental").value )*0.45
- getF
Copy link to clipboard
Copied
What happens when you use the form?
The field "Vs" is not the problem.
Copy link to clipboard
Copied
I'm assuming you are using calculation in "Total Purchase Price" field?
Did you try instead of simplified field notation use first option "value is the" and then "pick" and check fields you want in calculation?
Copy link to clipboard
Copied
The Simplified Field Notation has a problem with field names that start with a number. Rename them or use the Sum option, or a script.
Copy link to clipboard
Copied
Sorry guys, but on this one discussion I will have to disagree.
It is not necessary to rename all of your fields as suggested by Try67 nor use the "Value is" method as suggested by NesaNurani.
You can perfectly use the Simplified Field Notation method as long as you escape the numerical character and the special characters. This has been answered before in the forums.
As mentioned by Try67, you will run into problems because using a number as the first charachter in your field names (and then also followed by a special character) will be treated as numeric values not as a string of text (your actual field names).
To use Simplified Field Notation in such fashion you'll need to escape those charachters using a backslash "\" once before the number and once before the underscore ("_") of each field name.
To be able to do so just copy and paste the simplified notated code from here and you're good to go :
\1\_Amount+\2\_Amount+\3\_Amount+\4\_Amount+Vs+\5\_Amount+\6\_Amount
To complement this discussion here are some additional sources:
Copy link to clipboard
Copied
Thank you all for the responses. Everything is working now and I gained some valuable knowledge.
Copy link to clipboard
Copied
I forgot to add that escaping special characters when using Simplified Field Notation is explained in more detail in Chapter 4 of the Acrobat JavaScript Scripting Guide, " Using Acrobat JavaScript in Forms-Creating simple JavaScripts", page 57.
And here's the quote with the correct explanation:
The simplifed field notation makes it very easy to define relatively complex calculations.
Instead of typing:
event.value = ( getField("income.interest").value
+ getField("income.rental").value )*0.45
- getField("deductible").value;
the new syntax would require only:
(income\.interest + income\.rental)*0.45 - deductible
Note the backslash (\) before the period or dot (.) in the above example. To avoid
ambiguity, all operators (including the dot in the example), numbers, and whitespace
characters are assumed to separate field names. If those characters are used in a field name,
they may be specified in the Simplified Field Notation by escaping them with a backslash
character, as in the example. Quote characters used in a SimplifiedField Notation script will
be treated as part of a field name."