3 Replies Latest reply on Mar 20, 2009 6:54 AM by (BDow)

# help with scripts!

I have a form that was done in excel. I've now transferred it over to Acrobat 9. When doing this, some of my calculations do not work. They are only the if then statements. Here is what I had in excel: <br /><br />If (B9<C12,(B8+(B12*B5)),0) <br /><br />This should read as: If B9 is less than C12 then B8+(B12*B5), if not then 0.<br /><br />Someone helped me and gave me the following but it doesn't work!<br /><br />if(this.getField('B9').value < this.getField('C12').value) { event.value = this.getField('B8').value + (this.getField('B12').value * B5); } else { event.value = 0; } <br /><br />// or <br /><br />event.value = this.getField('B9').value < this.getField('C12').value? this.getField('B8').value + ( this.getField('B12').value * B5) : 0; <br /><br />Any suggestions would be much appreciated! Thank you.
• ###### 1. Re: help with scripts!
Use this:

if (this.getField("B9").value < this.getField("C12").value) { event.value = this.getField("B8").value + (this.getField("B12").value * this.getField("B5").value); } else { event.value = 0; }
• ###### 2. Re: help with scripts!
It worked!! Thank you very much!
• ###### 3. Re: help with scripts!
One more question...

One of my fields has a simple calculation of division (B13=B14/B6). I get an error message when filling out the form because it is trying to divide by zero. I've done a similar calculation in LiveCycle where I put (HasValue). However, I am now using Acrobat Forms instead and can't figure out what script to use.

Thank you.