Skip to main content
Participant
January 16, 2025
Answered

How do I make a form with a formula so that two numbers from other forms can be multiplied and then

  • January 16, 2025
  • 1 reply
  • 628 views

How do I make a form with a formula so that two numbers from other forms can be multiplied and then divided by the next number? For example, 40000*5%:105?

Correct answer Nesa Nurani

Use this as custom calculation script of "Field4":

var f1 = Number(this.getField("Field1").valueAsString);
var f2 = Number(this.getField("Field2").valueAsString);
var f3 = Number(this.getField("Field3").valueAsString);

if(f3 != 0)
 event.value = f1*f2/f3;
else
 event.value = 0;

Replace "Field1", "Field2", "Field3" with your actual field names.

1 reply

Nesa Nurani
Community Expert
Community Expert
January 16, 2025

You mean you have two fields where you input values, and you want to use calculation to show the result in the 3rd field?
What do you mean by 'next number', can you describe exactly what you want and include field names?

????_5915Author
Participant
January 16, 2025
I want to multiply field 1 by field 2 and divide field 3. The result should be in field 4.

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
January 16, 2025

Use this as custom calculation script of "Field4":

var f1 = Number(this.getField("Field1").valueAsString);
var f2 = Number(this.getField("Field2").valueAsString);
var f3 = Number(this.getField("Field3").valueAsString);

if(f3 != 0)
 event.value = f1*f2/f3;
else
 event.value = 0;

Replace "Field1", "Field2", "Field3" with your actual field names.