4 Replies Latest reply on Jul 2, 2013 2:31 PM by bettymac8

    Trying to do a calculation with a default value

    bettymac8

      Hi, I'm trying to duplicate the calc's in a spreadsheet, and am having trouble making a default value to match what's on the spreadsheet if nothing's filled in yet.  There's also a field in there that's named the same as another field so when the user inputs the amount in the first field, it pre-fills the 2nd field, then that field is used in a calc. 

       

      Here's my attempt to calculate a value in field K359 :

       

      var A359 = this.getField("A359").value; var F359 = this.getField("F359").value; if (F359 <= 0)event.value="$0.00"; else {event.value = A359/F359;}

       

      I've tried it several ways, but can't make it work, and I keep getting the "The value entered doesn't match the format of the field .  A359 and K359 are both formatted as numbers with 2 dec. and $.  F359 is just number with no dec. and no $.

       

      I would like K359 to show $0.00 when the F359 field is blank.

       

      My fields are as follows:

       

      A359   gets filled which pre-fills A359 below ....

       

      Then  A359 / F359 = K359

       

      I hope this is understandable......Please help!!!  Thanks