Skip to main content
ashleykraft
Participant
July 23, 2020
Answered

Multiplication Calculations where check boxes change value

  • July 23, 2020
  • 1 reply
  • 669 views

I'm trying to figure out this calculation but I'm only good with the basic stuff that doesn't include check boxes.

 

If no check boxes are checked, the calculation is PaidYouth*5.50*Term

If Check Box1 is checked the 5.50 changes to 2.50, so PaidYouth*2.50*Term,

If Check Box2 is checked, it changes to PaidYouth*3.50*Term.

This topic has been closed for replies.
Correct answer try67

Then you can use this code:

 

var multiplier = 5.5;
if (this.getField("Check Box1").valueAsString!="Off") multiplier=2.5;
else if (this.getField("Check Box2").valueAsString!="Off") multiplier=3.5;
event.value = Number(this.getField("PaidYouth").valueAsString)*Number(this.getField("Term").valueAsString)*multiplier;

1 reply

try67
Community Expert
Community Expert
July 23, 2020

What about if both boxes are checked?

ashleykraft
Participant
July 23, 2020

Both boxes shouldn't be checked at the same time (one is for regular youth and one is for a different program)

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 23, 2020

Then you can use this code:

 

var multiplier = 5.5;
if (this.getField("Check Box1").valueAsString!="Off") multiplier=2.5;
else if (this.getField("Check Box2").valueAsString!="Off") multiplier=3.5;
event.value = Number(this.getField("PaidYouth").valueAsString)*Number(this.getField("Term").valueAsString)*multiplier;