Have an idea?

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

Progress bar issue with block randomization

Hi I  have created a survey in 8.4.2 version, we are having 4 sections with least count pick, so the maximum sections can be seen by respondent is 4 and minimum is 1.

Whenever due to least count pick, if the last block of questions are picked based on the quota, the progress bar will be automatically increased to the current state of question in SSI design ( ex: before the screener the progress bar will be 15% and after the block pick it will be like 90% ) and the same vice versa cases when another block picked the progress bar will be down.

Can any one had faced the same issue, i have tried using  the question seen by keeping estimated percentage as 50% but still there is an issue. Please provide a solution for this
asked Apr 3, 2018 by sandeepkapalawai Bronze (1,455 points)
edited Apr 3, 2018 by sandeepkapalawai
Just a few comments ...

The progress bar works fantastic for those surveys that go direct from start to finish. Without loops, randomisation of blocks, questions, pages, etc., the progress bar option "Question position in the questionnaire" works very well.

When many questions are skipped and randomisation creeps in, the progress bar option "Questions seen" comes into play. This also prevents the progress bar going backwards.

When you have many variations in the questionnaire length and/or the number of questions displayed, the problems with the progress bar start to appear.

You can fiddle with the % for a "best fit", but it's difficult to cater for all variations, especially when there are many.

Another handy tool is to use the SSI Script function ProgressBarSet(Value).

If you know the questions to be displayed at some point within the survey, you can set the progress bar value using some SSI Script programming or Perl.

1 Answer

+3 votes
It's a bit of a chore to set up, but I've created a script that can do this.  It needs to be put on each page in the randomized blocks section:

[% Begin Unverified Perl
# Parameters
my $clist = 'list2';
my @pages = (4, 1, 2);
my $startProgress = 40;
my $endProgress = 70;

my $currentBlock = 1;
my $currentPage = 1;

# Set progress bar
my $curr = 0;
my $total = 0;
my $addingToCurrent = 1;
for (my $i = 1; $i <= LISTLENGTH($clist); $i++) {
    my $clistValue = LISTVALUE($clist, $i);
    $total += $pages[$clistValue - 1];
    if ($addingToCurrent) {
        if ($clistValue == $currentBlock) {
            $curr += $currentPage;
            $addingToCurrent = 0;
        else {
            $curr += $pages[$clistValue - 1];
my $prog;
if ($total == 1) {
    $prog = $endProgress;
else {
    $prog = $startProgress + ($endProgress - $startProgress) * ($curr - 1) / ($total - 1);
End Unverified %]

Lines 3-6 must be updated with general settings:

* Line 3 with the name of the constructed list used for the randomized blocks.
* Line 4 with a comma-split list of the number of pages in each randomized block.  In my example, the first block has four pages, the second block one, and the third block two.
* Line 5 with the progress bar value to be shown on the first randomized block page.
* Line 6 with the progress bar value to be shown on the last randomized block page.

Lines 8-9 must be updated with the settings for the current questionnaire page:

* Line 8 with which block the current page is on.
* Line 9 with which page this one is among the current block's pages.
answered Apr 3, 2018 by Zachary Platinum Sawtooth Software, Inc. (212,650 points)
Does this script also work, if not every block is shown to the respondents?
My study contains a CBC in block 2 but i can not change line 8, it will be the same for every page of this block.

Any ideas? thanks!
The script shouldn't have a problem with blocks being skipped for some respondents.

The use of an exercise in one of the blocks makes things trickier.  You should be able to just update line 8 like normal because the whole exercise is in the same block, but you can't update line 9 normally.  When you are adding this script to the CBC, please try replacing line 9 with this:

my $currentPage = 1;
my $questionName = QUESTIONNAME();
if ($questionName =~ m/_Random(\d+)$/) {
    $currentPage = $1;

Note that this assumes that the exercise has no fixed tasks and that the CBC block doesn't include pages with no CBC questions.  If either of those is untrue, the script will need further changes.