3 Replies Latest reply on May 4, 2015 1:00 AM by try67

if then

Hello

i have a buisiness with workers

i will use two texts

if var1 is 10-19 workers then var2=8

if var1 is 20-49 workers then var2=9

if var1 is 50-9 workers then var2=12

if var1 is 100-249 workers then var2=17

if var1 is 250-499 workers then var2=23

if var1 is 500-999 workers then var2=40

if var1 is 1000-1999 workers then var2=75

if var1 is 2000-3999 workers then var2=100

if var1 is 4000-5999 workers then var2=120

if var1 is 6000-9999 workers then var2=160

if var1 is 10000+ workers then var2=250

can somebody help me?

Thanks

• 1. Re: if then

As the custom calculation script of the second field:

```var v1 = Number(this.getField("var1").value);
if (v1>=10 && v1<=19) event.value = 8;
else if (v1>=20 && v1<=49) event.value = 9;
// etc.
else event.value = "";
```
• 2. Re: if then

i wrote it like this

// Get field values as numbers

var v1 = +getField("ΑΡΙΘΜΟΣ ΑΠΑΣΧΟΛΟΥΜΕΝΩΝ").value;

var v2 = +getField("Text1").value;var v1 = Number(this.getField("var1").value);

if (v1>=10 && v1<=19) event.value = 8;

else if (v1>=20 && v1<=49) event.value = 9;else if (v1>=50 && v1<=99) event.value = 12;

// etc.

else event.value = "";

and i have this problems

Acrobat JavaScript Debugger Functions Version 10.0

Acrobat EScript Built-in Functions Version 10.0

Acrobat SOAP 10.0

undefined

this.getField("var1") is null

5:Field:Calculate

TypeError: this.getField("var1") is null

5:Field:Calculate

• 3. Re: if then

I had assumed that "var1" is the name of your field... If that's not the case then just replace it with the actual field name.

You don't need to define the v2 variable.