Post

2 followers Follow
0
Avatar

Skip over value if no input

Hello all - using the below calculation to add up a selection of scores to create a Total Score. I have it set-up so that if the score is 0, the users don't enter anything at all in the inputs, to save time. But if some of the values in the calculation below have no input, the calculation does not work. Any help?

 

var a = @Touch Score;

var b = @Urgency Score;

var c = @Needs Score;

var d = @Services Score;

var e = @Causes Score;

var f = @Loyalty Score;

var g = @Expectations Score;

var h = @Authority Score;

var i = @Revenue Score;

 

var j = parseFloat(a);

var k = parseFloat(b);

var l = parseFloat(c);

var m = parseFloat(d);

var n = parseFloat(e);

var o = parseFloat(f);

var p = parseFloat(g);

var q = parseFloat(h);

var r = parseFloat(i);

 

var sum = j + k + l + m + n + o + p + q + r;

sum

Hanson Walker

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Hanson,

add || 0 (means: if no value then 0) behind each field token in var a-i, then var a-i will always have a value.

var a = @Touch Score || 0;

Rainer

Rainer Grabowski 0 votes