I have a series of fields that I would like to sum. I've tried using the script below to hide the field if all of the corresponding fields are blank and also perform the calculation if one of the fields is left out. However, I would like to re-write or figure out a script that allows the field to perform all of the above said functiona and also show a value of "0" if the function is validated as true.
Box 1: User Input
Box 2: User Input
Box 3: Box 1 - Box 2
Box 4 User Input
Box 5: User Input
Box 6: Box 4 + Box 6
var v1 = getField("Box 1").value!="" ? getField("Box 1").value : 0;
var v2 = getField("Box 2").value!="" ? getField("Box 2").value : 0;
var v3 = getField("Box 3").value!="" ? getField("Box 3").value : 0;
var v4 = getField("Box 4").value!="" ? getField("Box 4").value : 0;
var v5 = getField("Box 5").value!="" ? getField("Box 5").value : 0;
var v6 = getField("Box 6").value!="" ? getField("Box 6").value : 0;
event.value = ((v1+v2+v3+v4+v5+v6) !==0)?(v1+v2+v3+v4+v5+v6):"";