These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Divide a field by 6.7... why is this is hard?

iamyourpilot
Registered: Nov 11 2008
Posts: 4
Answered

I'm trying to figure out how to divide a field "LBS_01" by 6.7. And if =0 then text color is white. I found some script and put it together and go figure... it doesn't work. I keep getting syntax errors also. Does anyone have time to help me out or at least face me in the correct direction?

var a = this.getField("LBS_06");
var b = 6.7;
event.value = b / a.value;

event.value = . . . ;

if(event.value < 0)
event.target.textColor = ["G", 1];//Change text to white

else

event.target.textColor = ["G", 0];//Change text to black

My Product Information:
Acrobat Pro 9.0, Macintosh
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Is your field named "LBS_01" or "LBS06"? In any case, the following should work, assuming you want 6.7 to be the denominator, not the numerator as your code shows:

var v1 = getField("LBS_01").value; event.value = v1 / 6.7; if (event.value != 0 ) { event.target.textColor = color.black; } else { event.target.textColor = color.white; }

George
iamyourpilot
Registered: Nov 11 2008
Posts: 4
George! You are wonderful! That helped me out with the other calculations too. If your ever in Ocala I owe you lunch, really. Thanks again....

Now all I need do so find out how to convert 1.5 to HH:MM format, I think a saw that somewhere in the forum. Then soon after the world will be mine, Mawhahaha. OK maybe not.