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

Need help with FormCalc

rstovall
Registered: Dec 15 2009
Posts: 4
Answered

Hi, I was hoping someone here might be able to help me out with FormCalc.

Here is the code I'm using

if ( SquareFootage <= .43 ) then
Price == 15
elseif ( .43 < SquareFootage <= 1 ) then
35 * SquareFootage
elseif ( 1 < SquareFootage <= 4 ) then
31 * SquareFootage
elseif ( 4 < SquareFootage <= 9 ) then
29 * SquareFootage
elseif ( 9 < SquareFootage <= 16 ) then
27 * SquareFootage
elseif ( SquareFootage > 16 ) then
25 * SquareFootage
endif

The Price box this is in always calculates using 35 though. I can't get it to use the other options.

Any help would be greatly appreciated!

Thanks in advance!

Rich

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Fist, the set equal operator is '=' and not the equality operator, '=='.

For multiple comparisons, you souls should use one of the connective operators, 'or' 'and', and simple comparative statements. Or if you carefully work through the statements, you can use just a simple comparison.
if ( SquareFootage <= .43 ) then15elseif (SquareFootage <= 1 ) then35 * SquareFootageelseif (SquareFootage <= 4 ) then31 * SquareFootageelseif (SquareFootage <= 9 ) then29 * SquareFootageelseif (SquareFootage <= 16 ) then27 * SquareFootageelseif (SquareFootage > 16 ) then25 * SquareFootageendif

Some of this is covered in the Learning Center in the Tutorials or eSeminars on demand.

George Kaiser

jonom
Registered: Jan 31 2008
Posts: 133
You've definitely got some issues going on in the code. I recommend downloading the FormCalc User Reference from Adobe.

Quote:
if ( SquareFootage <= .43 ) then
Price == 15
That should read [b]Price = 15[/b]. "=" to assign a value "==" to test a value.

Quote:
elseif ( .43 < SquareFootage <= 1 ) then
35 * SquareFootage
elseif ( 1 < SquareFootage <= 4 ) then
31 * SquareFootage
elseif ( 4 < SquareFootage <= 9 ) then
29 * SquareFootage
elseif ( 9 < SquareFootage <= 16 ) then
27 * SquareFootage
Not sure what you're trying to do here. You start off in the first IF statement trying to assign a value to Price and then I'm not sure what exactly you are trying to accomplish.

Your syntax in the brackets above is not correct if you are trying to do AND/OR functions.

Taking the first line I think you are trying to say:
[b]elseif (SquareFootage > .43 and SquareFootage <= 1) then[/b]
Syntax may be off I don't use FormCalc a lot - it may need to be:
[b]elseif ((SquareFootage > .43) and (SquareFootage <= 1)) then[/b]But then you are multiplying SquareFootage by a number, not setting a value on Price.
rstovall
Registered: Dec 15 2009
Posts: 4
gkaiseril,

Many thanks for your help my friend! Your modifications worked perfectly for what I was trying to do! Very kind of you to take the time to help out!

Rich