Skip to main content
Participant
February 15, 2021
Answered

Help with Custom Calculation Script

  • February 15, 2021
  • 1 reply
  • 1266 views

Very new to this so appreciate the assistance!

 

My form  has three subtotal fields

 

COREPOINTS

MGMTPOINTS

C_MPOINTS

 

If the MGMT POINTS field is 0, would like the C_M field to be 0.

 

If the MGMT POINTS field has a value, would like the C_M field to reflect COREPOINTS + MGMTPOINTS.

 

Thank you!

 

 

 

This topic has been closed for replies.
Correct answer try67

As the custom calculation script of "C_M" (or "C_MPOINTS"... Again, you've used both names), enter the following:

 

var v1 = Number(this.getField("MGMTPOINTS").valueAsString);

var v2 = Number(this.getField("COREPOINTS ").valueAsString);

event.value = (v1==0) ? 0 : v1+v2;

1 reply

try67
Community Expert
Community Expert
February 15, 2021

Is there a space between "MGMT" and "POINTS", or not?

Participant
February 16, 2021

Apologizes - typo on my part! Thank you..

 

Subtotal Field 1 named COREPOINTS

Subtotal Field 2 named MGMTPOINTS

Subtotal Field 3 named C_MPOINTS

 

If the MGMTPOINTS field is 0, would like the C_M field to be 0.

 

If the MGMTPOINTS field has a value, would like the C_M field to reflect the total of  COREPOINTS + MGMTPOINTS.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 16, 2021

As the custom calculation script of "C_M" (or "C_MPOINTS"... Again, you've used both names), enter the following:

 

var v1 = Number(this.getField("MGMTPOINTS").valueAsString);

var v2 = Number(this.getField("COREPOINTS ").valueAsString);

event.value = (v1==0) ? 0 : v1+v2;