Calculations and lots of Conditionals
Howdy, knowledgeables!
I currently have eight tabs open on my browser in my effort to crack this code, and not one of them has helped me accomplish a simple, singular if/else effectively in a particular box's properties, which doesn't bode well for the fact that the ultimate if/else should be many, many lines tall.
What I need to create is three auto-filling field variations, two of which are not mathmatically derived but are numerical values unique from but reliant on the user-entered value of another field, while the third field IS the mathematical sum of the two auto-generated fields, but only if a checkbox is marked. At this point, I would very much just appreciate hunks of text I can copy and drop where they need to go!
So in other words, there are five total fields and one checkbox interacting in the chain: if the user enters into field "A" a value of "1", field "B" will automatically display a value of "3"; elsewhere, if the user enters into field "C" a value of "9," field "D" will automatically display a value of "7"; the final field "E" will be equal to the value of field "B", UNLESS checkbox "F" is selected, which should cause the final field to equal the sum of the values in field "B" and field "D".
what I've spent the past five hours troubleshooting variations of for my very first step in this series is this code, within the custom calculation property of field "B":
var A = this.getField( "A").value;
if( A = 1) event.value = -5;
else if( A = 2) event.value = -5;
else if( A = 3) event.value = -4;
else if( A = 4) event.value = -4;
else event.value = 0;What I get instead of the number associations desired is, whether the value of "A" is entered as 1, 3, or 35, field "B" only displays the last event.value that ISN'T zero--even if I reduce it to a singular "if" and "else". I've tried it with brackets, indentations, and removed/added spaces in an untold number of combinations, but my resulting "last non-zero event.value" doesn't change.
So as you can see from the above sample, the value I need displayed in "B" is not mathmatically derived from the user-entered value in "A", which will be the case with fields "C" and "D", albeit with different number associations, hence the need for if/else. What, then, should I actually be entering?
...And should you brilliant minds have an answer for my uneducated self in this, I can already tell you what my NEXT question will be in regards to field "E": how do I designate a checkbox's selected status into the conditional? I can't find a logical consensus.
