Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

problems with FormCalc code

I need help with FormCalc code in a calculation field.



I have the following user-entry fields set up in a form:



4 different price fields named: price_one, price_two, price_three, price_four

a photo size field named: enlarge_size, where a choice can be made from a drop down list of four different sizes: 5 x 7, 8 x 10, 11 x 14, 12 x 18

a quantity field named: quant



I then have a calculated field named: ext_cost, where I am attempting to use the following code:



if (enlarge_size = [5 x 7]) then

(quant * price_one)

elseif (enlarge_size = [8 x 10]) then

(quant * price_two)

elseif (enlarge_size = [11 x 14]) then

(quant * price_three)

elseif (enlarge_size = [12 x 18]) then

(quant * price_four)

endif



When I try to PDF preview it, I get an error message telling me that I have a syntax error near token '=' on line 1 column 18.



I understand the line 1, column 18 refers to the script editor window, but I can't figure out how to get my calculation field to work properly.



I am new to scripting, and so am only able to wrap my mind around FormCalc barely. So if anyone could point out what I am doing wrong with my code I would really appreciate it.



If it would help, I could email my form to you. Just let me know your email address.



Thanks for your help.

Curtis
6 Replies
Curtis,



I think you should have put quotes around [5 X 7] in your conditional statement this should be (enlarge_size = "[5 x 7]") assuming that the value is a string "[5 x 7]".



Make this change for other places as well.

(i.e: "[8 x 10]" , "[11 x 14]", "[12 x 18]" )



If it does not work, email me the form to jpham@pacbell.net
I am converting an Excel form into an Adobe form, via Designer. When it comes to the part where I need to enter a formula for "Sum" I keep getting script errors. I also have never done this before.



In the left hand column there are 5 fields that would be labels for items, followed by reference numbers in parentheses.

Example: Dresses(1)

Pants(5)

Shirts(6)

Total amount



The columns across from these are fields for the user to enter amounts accordingly. The last row the bottom of the columns is to tally the "Sum" of each column. I had entered the labels in the script editor area as Dresses(1)_1, and then the next column would read Dresses(1)_2 etc, to differentiate each column.

Also, I noticed in the Hierachy view that the field above these is incorporated into the scripting, something like this: Socks_Blue_Dresses_1

My "Sum" formula looks like this:Sum (Dresses_(1),Pants_(5),Shirts_(6)) However, no matter how I change it I keep getting script errors. Please help!



Sincerely,



R. Sinclair
OK SIMPLY I NOTE THAT YOU USE FIXED RANGE SO

//SAY

X=enlarge_size ;

//THEN DO THIS

if (X ==42) then

(quant * price_one)

elseif (X==80) then

(quant * price_two)

AND SO ON

endif
Thank you so much, Mo_hamed.



I'm just the new kid on the block!



'Hope you have a great week - what's left of it, anyway.



Sincerely,



Rose Ann 🙂
Hi all. I'm creating a form using Live Cycle and I'm like so totally new to scripting. I want to use the FormCalc function but having no luck. It's just a simple table with estimated prices for travel. Column 1 = Expense and Column 2 = Estimated Cost. The last row should be Cost = sum of the entries above it. But for the life of me I can get it to total. Getting some type of syntax error. Please help. Thanks.



Kimberley