I have a calculation (script below) where DN or DV are not always part of the sum. Trouble is both DV and DN have to be filled in to get the result.
How can I script these 2 fields to where one or both are calculated?
You need to clarify what you want. Are you saying that if either of those two fields are blank that you do not want to include them in the calculation?
What is the purpose of the inner square brackets?
It looks like we found an answer to my problem but I'm getting this error message.
My syntax calculates correctly but this error meg pops up.
Can you tell me what it means?
I can't see any error message. It must not have been included in the rest of the message.
And it looks like you responded via email and it included some personal info that you probably don't want on this public forum, but you can log in via the forum and edit your last post to remove it.
Hi. Thanks for your previous responses. I'm getting an error msg when I open this form in Reader and start entering info into the fields that are included in my calculation. Here's what the error box says:
Script failed (language is formcalc; content is xfa.form1.#subbform.WD1)
Error: arithmetic over/underflow.
Can you tell me what this means? I can still get the result I want, but each time I enter a number into one of the calculated fields I get this error msg. I click OK in the error msg and can continue.
It may be attempting to divide by zero, which will occur when the BPY field value evaluates to zero. To avoid this, you should check its value and only do the division if the value of BPY is a non-zero number.
Also, you don't need to use Sum(), it's for summing a range of values. And I'm not sure what's going on with the square brackets you're using - that looks really odd, the square brackets are used to denote instances of fields.
So your script should look more like:
$ = (PD1*DN/DV[WD1*CT])/BPY
Except, as I said above, I'm not sure what the value in the square brackets is doing.
Other than that you'll need to do as George said you'll need to script for the null values in the fields that are empty to stop the divide error. So you'll need an if statement that only fires once all the fields are filled in.