Level 1

0% to Level 2

Tip /

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

View all

## calculation script with multiple conditions 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! Level 2

You need more parenthesis.

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

//do stuff

}
{"ft_lang_label":"__label__en","ft_lang_prob":0.8813201,"math_prob":0.98103267,"size":1625,"snap":"2022-05-2022-21","text_gpt3_token_len":451,"char_repetition_ratio":0.16039482,"word_repetition_ratio":0.14134276,"special_character_ratio":0.2966154,"punctuation_ratio":0.1237785,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9639299,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-23T09:38:18Z\",\"WARC-Record-ID\":\"<urn:uuid:60b77f1f-6c7b-43bd-806b-2d533d317af6>\",\"Content-Length\":\"393016\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:7abef363-6640-4650-9c82-86fe42d97bdd>\",\"WARC-Concurrent-To\":\"<urn:uuid:a5fa33c3-90c1-4200-b50e-5157ff02952c>\",\"WARC-IP-Address\":\"18.67.76.107\",\"WARC-Target-URI\":\"https://experienceleaguecommunities.adobe.com/t5/adobe-livecycle-questions/calculation-script-with-multiple-conditions/td-p/145006\",\"WARC-Payload-Digest\":\"sha1:ZCSLHRMB4ZZWDNVIVDUAI3ZXOGURL7JS\",\"WARC-Block-Digest\":\"sha1:TIKHNXHTUXJDB7CN55ASLLNRBVMAJPPH\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662556725.76_warc_CC-MAIN-20220523071517-20220523101517-00377.warc.gz\"}"}