These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Scripting help using a check box to determine a further calculation

krittinger
Registered: Jun 14 2010
Posts: 18
Answered

I am writing a script where taxes are calculated if a "Payable" check box is marked. I have tried without success to come up with right script using Formcalc.

The basic calculation is
PST=(Difference+Admin*.05)

What I am trying to do is script the following .....

If the check box is checked off as "Payable" then the PST is calculated. If the box is not checked off then PST is not calculated. In Check Box Binding Name is "Payable" , the on value is 1 and 0 is off

I have tried different several variables in my formula without success such as these examples
PST=(if PAYABLE=1 then DIFFERENCE+ADMIN*.05)
PST=(DIFFERENCE+ADMIN*.05) if PAYABLE=1
if PAYABLE=1 then PST=DIFFERENCE+ADMIN*.05

Can anyone make sense of what I am trying to do and direct me??

Thank You in Advance

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The last example is sort of correct. You need to follow the examples in the documentation. The comparison operator is "==" and "if" statements end with an "endif"

if( PAYABLE==1) then
PST = DIFFERENCE+ADMIN*.05
endif

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

krittinger
Registered: Jun 14 2010
Posts: 18
Does that script go in the calculation field of the Check Box or the PST??
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The script should be placed in the "PST" field. and if it is a calculation it should be written like this:

if( PAYABLE==1) then
DIFFERENCE+ADMIN*.05
endif

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

krittinger
Registered: Jun 14 2010
Posts: 18
Thank You Thom!!!!
you have made me a very happy man!!!! It only took me 3 hrs........LOL