How to do an if then statement based on the value of a field on a PDF form
Dear All,

I hope somebody can help me. I'm not a programmer but need to create some calculations within a PDF form. I am trying to calculate the number of daily calories required based on a number of criteria. I have managed to make the calculation work if I am just looking at the values of each field but I need to take into account if the user is male or female. For example: If the user is male then use: 1066 + (6.23 * v4) + (12.7 * v3) - (6.8 * v2) and If the user is Female use: 66 + (6.23 * v4) + (12.7 * v3) - (6.8 * v2).
I am performing the calculation in the Calories field.
This is what I have so far which does work but doesn't have the capacity to change between male or female.
(function() {
var v1 = +getField("Gender").value;
var v2 = +getField("Age").value;
var v3 = +getField("Height").value;
var v4 = +getField("Weight").value;
var v5 = +getField("Activity").value;
var result = 66 + (6.23 * v4) + (12.7 * v3) - (6.8 * v2);
event.value = result;
})();
Thank you in advance.
