3 Replies Latest reply on Nov 28, 2017 7:16 AM by George_Johnson

    Field won't calculate properly

    LizziQueen

      I'm working on a fairly complex form that calculates lots of different fields and this ONE FIELD is being super weird.

       

      It's one of the last fields for validation to make sure the user has input the right amounts.

       

      So the relevant fields are:

       

      DC Amount - freeform

       

      Div Funding -  Calculated as 12% of DC Amount

       

      AW Fee - This has a custom calculation so it varies depending on DC Amount, but usually it's 1% of DC Amount.

       

      var Total = this.getField("DC Amount").value;
      var sponsor = this.getField("sponsor").value;
      
      if (sponsor=="A") {
          event.value = 0;
      }
          else if (sponsor == B" ) {
              if (Total <= 10000) {
          event.value = 0;
      } else if (Total >= 1500000) {
          event.value = 15000
      } else {
           event.value = Total * .01;
      }
      }
      

       

      So, if I put DC Amount as 50,000, AW Fee is 500.

       

      Other Funding - Freeform

       

      Funding Validation - This is the troublesome field. Basically it's calculated like this:

       

      Div Funding - (Other Funding + AW Fee)

       

      And the total should end up as 0.

       

      Simple, right?

       

      So if my DC Amount is 50,000, the Div Funding is calculated as 6000, and the AW Fee is 500.

       

      At that point, my Funding Validation shows 5500, which is correct.

       

      So in theory I should be able to put 5500 into Other Funding, which will make the formula 6000 - (5500 + 500) and the field will show 0.

       

      But it does not. Instead, it shows... -5,494,500

       

      However, if I put in any amount under 10, it just subtracts normally.

       

      I think it's something with the AW Fee field calculation that's messing it up but I can't figure it out at all.