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

Calculating from a dropdown menu

chippster
Registered: Dec 15 2008
Posts: 6
Answered

I've created a form with a drop down menu, amongst other numeric fields.

The last field is my total...but I'm having issues getting the calculation to work correctly.

In the drop down i have 5 choices listed. Under binding on that drop down, I've given each item it's own value. so the first option is 1, next is 2, etc.

So in my calculation, i wanted to run an if statement. If option 1 from the drop down is chosen, then multiply x * .5. if option 2 is chosen, then multiply x * .75, etc.

This is what I have so far:

if (HasValue(buildingtype1)) then
$.rawValue = Concat(250*.50)
else
if (HasValue(buildingtype2)) then
$.rawValue = Concat(250*lots*.50)
else
if (HasValue(buildingtype3)) then
$.rawValue = Concat(500)
else
if (HasValue(buildingtype4)) then
$.rawValue = Concat(1000)
else
if (HasValue(buildingtype1)) then
$.rawValue = Concat(20000)
else
$.rawValue = ""
endif

Of course I get an error when i switch from design view to PDF view to test it....

I'm also wanting to add other things in that total field, not just this drop down box.

any suggestions?

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
So you have one field that is a list box or combo box with 5 options. Those opptions are numbered 1 thru 5. And if an option is selected you want to either compute a value or assign a value to a given field. Assuming your list box/combo box field is named "buildingtype":
if (buildingtype.rawValue eq 1) then$.rawValue = 250*.50 // type 1elseif (buildingtype.rawValue eq 2) then$.rawValue = 250 * lots.rawValue *.50 // type 2elseif (buildingtype.rawValue eq 3) then$.rawValue = 500 // type 3elseif (buildingtype.rawValue eq 4) then$.rawValue = 1000 // type 4elseif (buildingtype.rawValue eq 5) then$.rawValue = 20000 // type 5else$.rawValue = "" // no valid selection madeendif

The "HasValue()" returns true when a selection has been made. "eq" or "==" is the equal operator. The "Concat()" function creates a character string from one or more values.

George Kaiser

chippster
Registered: Dec 15 2008
Posts: 6
Thank you so much!