JS help

Out of context: Reply #12

  • Started
  • Last post
  • 13 Responses
  • i_monk0

    So I solved it... by completely ignoring the PV function coding I found and figuring out the actual math involved (the "else" below).

    var N_Shortfall = this.getField("N_Shortfall").val...
    var N_Rate = this.getField("N_Rate").value / 100;
    var N_Years = this.getField("N_Years").value;
    var N_ComInt = Math.pow((1+N_Rate),N_Years);

    if (N_Rate == 0) {
    N_No = 0 - (N_Shortfall * N_Years);
    }
    else {
    N_No = (-N_Shortfall * (1 + N_Rate) * ((N_ComInt - 1)/N_Rate))/N_ComInt;
    }
    this.getField("N_Amount").value = Math.abs(N_No);

View thread