Jump to content

Custom Calculation for Subtraction


Recommended Posts

Alan Grzybowski
Posted

I'm trying to create a form for subtraction but I'm not familiar with javascripts

  • 2 years later...
  • 2 months later...
  • Official Nitronaut
Reymund Oyong
Posted (edited)

Greetings, @Alan Grzybowski @Joe Smith

Thank you for reaching out through our Community Forums!

Below is a sample script if you wish to subtract one or multiple fields from another field. The script should be placed on the field where you want to display the result. 
In this example, Text3 has the script to subtract Text1 and Text2. 

// Obtain the value from the first field
var v1 = getField("Text1").value;
// Obtain the value from the second field
var v2 = getField("Text2").value;
// Set this field value equal to the difference
event.value = v1 - v2;

You will change "Text1" and "Text2" to the names of the text fields that you have chosen. This will subtract Text1 from Text2.

image.png.03e4547384484a7ac22227c7f1a84c91.png

Kind regards, 

Edited by Reymund Oyong

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.