Sawtooth Software: The Survey Software of Choice

Changing Values of MaxDiffCurrentSet

In SSI Web 8, I've programmed some dummy MaxDiff choice tasks at the beginning of my MaxDiff exercise using a free format question. Now, I would like to change the counter value that is displayed in the MaxDiff exercise to accommodate those extra tasks. I tried the following code ([% MaxDiffCurrentSet()+19 %] of [% MaxDiffTotalSets()+19 %]) but it just displayed 19 of 19. How can I accomplish this?

The following code will definitely not work, as you have experienced.

([% MaxDiffCurrentSet()+19 %] of [% MaxDiffTotalSets()+19 %])

It doesn't work because these two SSI Script functions are actually placeholders that run before Perl executes and won't allow mathematical calculations. That's why they blow up and display (19 of 19).

So, for a work-around, here are three options.

1. Define a new text question on the same page as each MaxDiff question that only features the text you want displayed, such as (10 of 19).

2. Use the PageNumber() function, which does allow the addition or subtraction of numbers. For example:

[%PageNumber()-3%] of 19

3. Use some jQuery code somewhere on each MaxDiff page, like this:

<div id="counter"></div>

<script type="text/javascript">
$(document).ready(function() {
  $("#counter").html([% MaxDiffCurrentSet() %]+19);
  $("#counter").append(" of ");
  $("#counter").append([% MaxDiffTotalSets() %]+19); 
});
</script>

Sawtooth Software

6:30 AM to 5:30 PM Mountain Time
(GMT-6; GMT-7 Autumn/Winter)
Monday through Friday

Phone: +1 801 477 4700
Fax: +1 801 434 5493
Email: support@sawtoothsoftware.com

We are open!

SKIM Software

9:00 AM to 5:30 PM Central European
(GMT+2; GMT+1 Autumn/Winter)
Monday through Friday

Phone: +31 10 282 3500
Fax: +31 10 282 3560
Email: software@skimgroup.com
Online: www.skimgroup.com

Lighthouse Studio

Lighthouse Studio is our flagship software for producing and analyzing online and offline surveys. It contains modules for general interviewing, choice-based conjoint, adaptive choice-based conjoint, adaptive choice analysis, choice-value analysis, and maxdiff exercises.

Try Lighthouse Studio

  Buy Lighthouse Studio