0 votes
in SoSci Survey (English) by s291395 (135 points)

Hi,

I'm working on a factorial experiment, using a sub-questionnaire to show different vignettes to the respondents. However, when in the sub-questionnaire, the progress bar is set to 33% and does not update. As this part takes up quite some survey time I would like to show the respondent that they are progressing.

I see that you can set the progress manually with option('progress', ##);, but don't know how to incorporate this.

My code to start the sub-questionnaire looks like this

// Loop over vignette IDs with loopPage
$Var = loopPage($keyVar);
// Add key to attribute order array
$orderAtt[] = value($Var, 'free');
// Start multilevel survey, sending attribute order and vignette key
multiLevelDown('sub', $orderAtt);

where $orderAtt contains an array with information about stimuli order, and $keyVar contains a vignette id to be used with database for contents.

I'm thinking it might be an idea to create a variable $progress, set it to say 2 and for each loop add another 2. Tat could be added to $orderAtt and used to update the progress bar.

However, I do not know where in the code to put such a solution, as I'm not understanding exactly how the loopPage works.

Any help would be appreciated!

1 Answer

+1 vote
by SoSci Survey (327k points)

A soon as you use multiLevelDown(), a new case is started, and this has its own progress bar. Also, SoSci Survey does not know a-priori how many loops to expect, and therefore cannot adjust the progress indicator before going down into the subordinate case.

In short, the easiest solution is to disable the progress bar in the questionnaire settings.

The more elaborate way is to adjust the progress bar via option(). To stay consistent in the subordinate case, you must not only give the $Var, but you will also need a counter.

$i = loopPage(count($keyVar));
$Var = $keyVar[$i];

Handle this counter to the subordinate interview as foundation to calculate and adjust the progress bar.

by s291395 (135 points)
Thanks, that worked!

I solved it like this

In main survey:

//--------------------------------------------------------
// Setting up the subsurvey for factorial experiment - with updated progress bar
//--------------------------------------------------------

$i = loopPage(count($keyVar));
$Var = $keyVar[$i];
// Add key to attribute order array
$orderAtt[] = value($Var, 'free');
$orderAtt[] = $i;
// Start multilevel survey, sending attribute order and vignette key
multiLevelDown('sub', $orderAtt);


In subsurvey:


//---------------------------------------------------
// FACTORIAL EXPERIMENT - SUBQUESTIONNAIRE
//---------------------------------------------------

// Load data
$data = multiLevelData();

// Extract i directly
$i = $data[8];


// Set progress based on the value of $i
if ($i >= 0 && $i <= 8) {
    $progress = 6 + 3 * $i;
    option('progress', $progress);
}

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...