Help with simple conditional form

Community Beginner ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

Hi,

I just need to create a calculation in which, in column A (Número de tarjetas a almacenar) you have a list of options to be selected. Depending on the option you select, the price is shown on column B.

Singular Fact captura _379.jpg

Just with this, I would be really happy :-).

An aditional question is if I can determine as an exeption that if you select the last option "Más de 10000", then the price "Coste mensual" is calculated with a formula which is a number from another box* 3

Many thanks!

TOPICS
Acrobat SDK and JavaScript

Views

170

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Aug 06, 2018 Aug 06, 2018
OK. As the custom calculation script of the text field you can enter something like this:var v = this.getField("Número de tarjetas a almacenar").valueAsString;if (v=="0 - 300") event.value = "8€";else if (v=="300 - 600") event.value = "11€";else if (v=="600 - 1000") event.value = "15€";// etc.

Likes

Translate

Translate
Adobe Community Professional ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

You need to provide the full details of which value should appear in the text field for each of the values selected in the drop-down.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

0 - 300                   8€

300 - 600               11€

600 - 1000               15€

1000 - 3000               35€

3000 - 5000               60€

5000 - 10000               100€

Mas de 10.000               Precio personalizado

Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

OK. As the custom calculation script of the text field you can enter something like this:

var v = this.getField("Número de tarjetas a almacenar").valueAsString;

if (v=="0 - 300") event.value = "8€";

else if (v=="300 - 600") event.value = "11€";

else if (v=="600 - 1000") event.value = "15€";

// etc.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

Thank! It works!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

One last thing. How can I say if a value from column A is greater than 10000 then multiply by 0,03?

Thanks!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

Multiply what, exactly?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

So basically if I write a number higher than 10000 on column A multiply it by 0,03 on column B. Otherwise write "Not valid" on column B

Singular Fact captura _382.jpg

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

Is "Column A" the drop-down field? If not, what is the name of that field, and that of Column B?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

No drop down as I had to separate 1 range.

Column A field is called "ServiciosPlus-Tarjetasincluidas10000"

Column B is the calculation destination, called "ServiciosPlus-Coste10000"

Whatever value I put in column A needs to be multiplied by 0,03 except if it is under 10000 (if that´s the case a "Not valid" message should be shown

thanks!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

OK, then use this code as the custom calculation script of the second field:

var v = Number(this.getField("ServiciosPlus-Tarjetasincluidas10000").valueAsString);

if (v<10000) event.value = "Not valid";

else event.value = v * 0.03;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

LATEST

Thanks again!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines