2 Replies Latest reply on Feb 26, 2017 9:39 AM by rsbisa

    If else statement. What am I doing wrong here?

    rsbisa Level 1

      I have a list box, Tuition, with three available values, 0 (default), 1649, and 1872. In another field (FICA), I want to create a conditional calculation based on the result of what is selected in Tuition. The purpose is to determine if an amount is taxable based on the result of a calculation. But, I can't even get past square 1, determining which item User has selected!

       

      This is not the entire script that will eventually be in FICA. I'm just trying to diagnose my problem.

       

      The following code was copied from a tutorial.

       

      var nTuition = this.getField("Tuition").value;

      if( nTuition = 1649) event.value = 1649;

      else event.value = 1872;

       

      When executed, the above will only return 1649, regardless of what is selected in Tuition. I have Tuition execute the calculation immediately. And, the FICA field is top in the calculation order. 1649 appears in FICA, even after resetting all fields (should be 0). It would seem, given the above code, that the default Tuition value of 0 would return 1872, no?

       

      What is going on here???

       

      Thanks!