Expand my Community achievements bar.

calculation script with multiple conditions

Avatar

Level 2

Hi. I am recreating an order form in Livecycle. I'd like to auto-populate some of the pricing info on the bottom based on data input on the top half of the form.

I've tried several different sets of code, and come up with nothing that works.

Here's an example scenario:

If the checkbox for "offshore" and "bolting" is checked, the numeric field associated with bolting should be $50 * whatever number is in the bolting quantity box.


So i need the script to check the offshore checkbox, and the bolting checkbox, assign a value to the numeric field and multiply it by another numeric field.

There is the added complication of some customers having custom pricing, so I'd need to also figure out a code that is based on the customer selection.

I also thought about, perhaps, putting the price info in drop down lists and enabling/disabling them based on the checkboxes up top.

Ideally, though, the first scenario would be my preference.

I tried this code (and many other variations of it) in both javascript and formcalc...in formcalc i get an error about the &.

if (offshore == 1) && (bolting == 1) then
$.rawValue == $50.00
elseif
(inland == 1) && (bolting == 1) then
$.rawValue == $50.00
elseif
(land == 1) && (bolting == 1) then
$.rawValue == $55.00
elseif
(rig == 1) && (bolting == 1) then
$.rawValue == $50.00
elseif
(plant == 1) && (bolting == 1) then
$.rawValue == $50.00
elseif
(yard == 1) && (bolting == 1) then
$.rawValue == $55.00
else
$.rawValue = 0
endif

any help would be appreciated!

1 Reply

Avatar

Level 2

You need more parenthesis.      

if ((offshore==1) && (bolting==1)){

//do stuff

}