Skip to main content
Participant
October 6, 2023
Answered

Add the greater of two numbers

  • October 6, 2023
  • 1 reply
  • 349 views

I am creating a document and the last calculation I need is the addition of the higher of two fields. What script do I need to add in. 

 The three fields are below. I need to add Total Income to the higher or either Income From Asset Value or Imputed Value and if both are 0 then 0 or no change. 

 

var fld1=this.getField("Income Total").value;
var fld2=this.getField("Income From Asset Value").value;
var fld3=this.getField("Imputed Value").value;

This topic has been closed for replies.
Correct answer try67

event.value = fld1 + Math.max(fld2, fld3);

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 6, 2023

event.value = fld1 + Math.max(fld2, fld3);