4 Replies Latest reply on Feb 16, 2012 12:41 PM by me@gbsi

    I need help converting an excel formula to javascript for a fillable form.


      Here is the scenario,

      If a person travels for 1 or 2 days we pay out a mealsrate of 75% per day. If 3 or more days we pay # days less 2 days * 25%. I hope that makes sense.



      V7 = Days, F14 = Mealsrate


      Formula in Excel


      =IF($V$7 = 1,$F$14*0.75,($V$7*$F$14)-(($F$14*0.25)*2))  and it works.


      I am VERY NEW to javascript (like yesterday) so don't laugh. I really have no idea what I am doing, but I was trying. Here is what i got. (by the way, It doesn't work)


      if(this.getField( ("Days").value=="1")){

      var f =this.getField("Mealsrate");

      event.value= f.value * .75;

      }else event.value = (Days * f.value)- (f.value *.25)*2;


      I appreciate all the help i can get.




      I'll be back on Monday, I hope I can find my post.