I have 17 segments that are named SP1 through SP17. Each of the fields can have value of 0, 1, 2, 3, 4, or 9.
I know how to add up all the fields i.e. event.value = this.getField("SP1").value + this.getField("SP2").value +... + this.getField("SP17").value
But I would like to recode the 9 into 0, so if a user enters 9 in one of the field it is not counted and should be treated as a 0 in the equation.
I was thinking about creating a new field for each SP and recode the value to 0 if the initial value was 9 and then adding up from the new fields. However this seems redundant.
Is there another way of just counting the 9s as 0 in the initial equation?