Quantcast
Channel: Adobe Community : Unanswered Discussions - Acrobat
Viewing all articles
Browse latest Browse all 73766

Create conditional output based on values of a calculated field

$
0
0

I am creating a form and need a discount percentage to appear based on value of "DISC Q 12"". So far, I have the following code:

 

var nSubTotal = this.getField("DISC Q 12").value;

if( 24 < nSubTotal < 250 ) event.value = .10;

var nSubTotal = this.getField("DISC Q 12").value;

if( 249 < nSubTotal < 500 ) event.value = .25;

var nSubTotal = this.getField("DISC Q 12").value;

if( 499 < nSubTotal < 1000 ) event.value = .35;

var nSubTotal = this.getField("DISC Q 12").value;

if( nSubTotal > 999 ) event.value = .45;

 

Any number less than 999 gives the .35 response which I assume is because this code:

 

var nSubTotal = this.getField("DISC Q 12").value;

if( 499 < nSubTotal < 1000 ) event.value = .35;

 

overrides the others. If I remove the code that results in .35, it just goes down to .25 if the number is still elss than 500.

 

Is there a way to set the ranges for a specific output? Any ideas on how I can set this code so that the following outcome is achieved?

 

Q < 25 = 0

24 < Q < 250 = .15

249 < Q < 500 = .25

499 < Q < 100 = .35

Q > 999 = .45


Viewing all articles
Browse latest Browse all 73766

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>