Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Adding a counter to a numeric column direction grid

I have a column direction grid. All responses are numeric. We are collecting %'s.

2 columns. Anywhere from 5-10 rows (waiting approval on these details).

I'd like to place a total % counter somewhere on the page which simply adds up the total of all numeric cells.

I would also like to ensure the total adds to 100%.

Seeking suitable JavaScript to assist.

Kind regards.
asked Apr 29, 2019 by Paul Moon Platinum (101,255 points)

1 Answer

0 votes
The scripts you're looking for:

<span class="gridtotal"></span>

$(document).on('keyup', '#[% QuestionName() %]_div .numeric_input', updateGridTotal);

function updateGridTotal() {
    var total = 0;
    $('#[% QuestionName() %]_div .numeric_input').each(function(){
        total += SSI_GetValue(this.id);

var total = 0;
$('#[% QuestionName() %]_div .numeric_input').each(function(){
    total += SSI_GetValue(this.id);
if (total != 100) {
    strErrorMessage = 'Error';
answered Apr 29, 2019 by Zachary Platinum Sawtooth Software, Inc. (214,675 points)
Thanks Zachary. Apologies for not getting back to you sooner. It was one of those days!

I'll test this out tomorrow and report back to this post.

As usual, thank you for the wonderful support. Onya mate!