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

If Then Statement (Basic)

Thelisha
Registered: Dec 26 2007
Posts: 10
Answered

I am trying to create a basic IF THEN statement using LiveCycle 8 with a form that was orginally a PDF file.

I have two columns that lists these items:

The 1st Column:

Total Income:
Total Expenses:
Surplus:

The 2nd column

Total Income:
Total Expenses:
Deficit:

For both columns the Total Income and the Total Expenses are pulled from other fields and populate. What I want to happen is if the Total Income is less than the Total Expenses then the number would appear in the "Deficit" field, if the Total Income is more than the Total Expenses it would appear in the Surplus field. I tried to create a basic IF THEN statement and I received this error message:

Script failed(language is formcalc; context is xfa[0].form[0].topmostSubform[0].Page3[0].Surplus[0]) script=if (TMI > TotalMonthlyExpense) then . Error: syntax error near token '.' on line 1, column 39 Script failed (language is formcalc; context is xfa[0].form[0]topmostSubform[0].Page3[0].Surplus[0]) script=if (TMI > TotalMonthlyExpense) thenvalue = (TMI-TotalMonthlyExpenses) Error: syntax error near token ')' on line 1 column 70.

This was the calcuation script I used that generated that error:

if(TMI > TotalMonthlyExpense)then value = (TMI - TotalMonthlyExpenses)

From this can anyone tell what I am doing wrong? Thanks in advance for your help. Hope this made sense!

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

in FormCalc you need to terminate the if expresssion with the "endif" tag.
Also, you better don't use variable names like "value", because those are reserve for other things.

  1. if (AAA > BBB) then
  2. $ = AAA - BBB //$ is equivalent to 'this' in FormCalc
  3. endif

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Thelisha
Registered: Dec 26 2007
Posts: 10
Thank you so much!!! That worked and I was able to have the my form behave as I wished. Thank you again for your help!