Skip to main content
nathanh91795179
Participant
March 10, 2016
Question

Plus Minus Formula?

  • March 10, 2016
  • 2 replies
  • 678 views

I am currently trying to get 2 of the same fields to look for a discrepancy between the two.

The formula I am using is:

function _Sum() {

var total = 0;

for (var count=0; count<_Sum.arguments.length; count++) {

  if ( _Sum.arguments[count] )

   total += _Sum.arguments[count];

}

return(total);

}

event.value = _Sum(((this.getField("discrepancy")).value*(-1)))

Is there something I am missing. I am also trying to get a field to still be editable and still calculate the numbers. What should I do to get this to work properly?

This topic has been closed for replies.

2 replies

nathanh91795179
Participant
March 10, 2016

What I have is a text field that needs to equal three different text field subtracted from each other but still have the field to be able to be edited manually.

try67
Community Expert
Community Expert
March 10, 2016

I don't see how your code achieves anything close to that...

try67
Community Expert
Community Expert
March 10, 2016

What's the point of a sum function if you're only providing it with one

parameter?

On Thu, Mar 10, 2016 at 7:20 PM, nathanh91795179 <forums_noreply@adobe.com>

nathanh91795179
Participant
March 10, 2016

That is the only parameter I need in this form. The fields I am looking for a discrepancy in are identical fields

try67
Community Expert
Community Expert
March 10, 2016

I don't follow... If they're identical (with the same name?) how can there be a discrepancy?

If you want this field to just have the same value as the other field, only multiplied by -1, simply use this code:

event.value = Number(this.getField("discrepancy").value) * -1;