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

IF expression

thornhillt
Registered: Feb 7 2008
Posts: 15

This an IF statement I have included on my form, the first portion works. When I select the checkbox "SecStudentDisc" it will subtract 200 fron the TotalTuition, but when I select another check box the action does not happen.

What have I done wrong?

if (SecStudentDisc >=1) then
TotalTuition -200
else (ThirdStudentDisc >=1) then
TotalTuition -800
else (FourthStudentDisc >=1) then
TotalTuition -1800
else
TotalTuition
endif

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
It sounds like you have 3 different check boxes to test for but you do not specify if all three or a combination of the boxes could be checked. It appears one would also need the preceding boxes checked to get the next level up of the discount.

if (SecStudentDisc >= 1 & ThirdStudentDisc => 1 & FourthStudentDisc >= 1) then
totalTuition - 1800
endif

if (SecStudentDisc >= 1 & ThirdStudentDisc => 1) then
totalTuition - 800
endif

if (SecStudentDisc >= 1) then
totalTuition - 200
endif

or

var test = 0
// build a binary value for testing
if (SecStudentDisc >=1) then
test +=1
endif
if (ThirdStudentDisc >=1) then
test +=2
endif
if (ForthStudentDisc >=1) then
test +=4
endif

switch(test) {
case 7:
totalTuition - 1800
case 3:
totalTuition - 800
case 1:
totalTuition - 200
break;
}

George Kaiser

thornhillt
Registered: Feb 7 2008
Posts: 15
if the first checkbox is =1 then a $200 discount is applied, if checkbox 1 & 2 are checked a discount of $800 is applied, if checkbox 1,2 & 3 all =1 then a discount of $1800 is applied.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
if (SecStudentDisc >= 1 & ThirdStudentDisc => 1 & FourthStudentDisc >= 1) then
totalTuition - 1800
elseif (SecStudentDisc >= 1 & ThirdStudentDisc => 1) then
totalTuition - 800
elseif (SecStudentDisc >= 1) then
totalTuition - 200
endif

or

var test = 0
// build a binary value for testing
if (SecStudentDisc >=1) then
test +=1
endif
if (ThirdStudentDisc >=1) then
test +=2
endif
if (ForthStudentDisc >=1) then
test +=4
endif

switch(test) {
case 7:
totalTuition - 1800
break;
case 3:
totalTuition - 800
break;
case 1:
totalTuition - 200
break;

George Kaiser

thornhillt
Registered: Feb 7 2008
Posts: 15
Thank you are are great.