Here is what I have now,
// Get the field values
var Z = this.getField ("Zone").valueAsString; // Value as a string
var A = this.getField ("500yr").value; // Value as a number
var B = this.getField ("LAG").value; // Value as a number
var C = this.getField ("HAG").value; // Value as a number
var D = this.getField ("100yr").value; // Value as a number
if ((Z == "X-SHADED" || Z == "AE" || Z == "X-SHADED/AE") && B < A && B < D)
event.value = (A + 2);
else if ((Z == "X-SHADED" || Z == "AE") && B > D && B < A)
event.value = (A);
else if (Z == "X")
event.value = (C + 1);
So far it appears to be working but I haven't tested it with all the necessary values yet. Thank you for helping me get this far
Here's how the code is written with indents and brackets.
The brackest are only necessary when there is more than one line in the "if" block. But I've shown them here for completeness.
I've also added extra parenthese around some of the comparison opertators to enforce the grouping/order of operations. This is very helpful when operator precedence is not obvious.
var Z = this.getField ("Zone").valueAsString; // Value as a string
var A = this.getField ("500yr").value; // Value as a number
var B = this.getField ("LAG").value; // Value as a number
var C = this.getField ("HAG").value; // Value as a number
var D = this.getField ("100yr").value; // Value as a number
if (((Z == "X-SHADED") || (Z == "AE") || (Z == "X-SHADED/AE")) && (B < A) && (B < D))
{
event.value = (A + 2);
}
else if (((Z == "X-SHADED") || (Z == "AE")) && (B > D) && (B < A))
{
event.value = (A);
}
else if (Z == "X")
{
event.value = (C + 1);
}