Skip to main content
Participant
Oct 6, 2023 8:00 PM UTC
Answered

Add the greater of two numbers

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 is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Oct 6, 2023 8:12 PM UTC

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

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Oct 6, 2023 8:12 PM UTC

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

Translate