Skip to main content
Participant
Jan 16, 2025 6:56 AM UTC
Answered

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

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?

Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
Jan 16, 2025 9:19 AM UTC

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.

4 replies

Nesa Nurani
Community Expert
Community Expert
Jan 16, 2025 7:04 AM UTC

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?

Translate
????_5915Author
Participant
Jan 16, 2025 8:53 AM UTC
I want to multiply field 1 by field 2 and divide field 3. The result should be in field 4.

Translate
Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
Jan 16, 2025 9:19 AM UTC

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.

Translate