Translations of this page:
 

Table of Contents

caseNumber()

int caseNumber()

Each questionnaire in the survey project has a unique number, which also appears as the variable CASE in the data record (Addition Variables in the Data Set). This number can be called up with the function caseNumber().

Example 1

The participant should maybe note down the number of their questionnaire so they can request an individual analysis later on.

html('<p>This is the questionnaire no. '.caseNumber().'</p>');

However, the predefined placeholder %caseNumber% could also be used to give the same result:

html('<p>This is the questionnaire no. %caseNumber%</p>');

Example 2

Or, the survey is composed of several questionnaires, because the second questionnaire (stimulus analysis) can be filled out multiple times, while the first questionnaire (master data) is only filled out once.

The various different data records belonging to a participant can be assigned with the case number. The following PHP code in the first questionnaire leads the participant to another questionnaire, and submits the case number as a reference (URL to the Questionnaire).

$num = caseNumber();
$url = 'https://www.soscisurvey.de/followup/?r='.$num;
redirect($url);

The same thing but a little more compact:

redirect('https://www.soscisurvey.de/followup/?r='.caseNumber());

The function redirect() supports placeholders as well as html() and text elements:

redirect('https://www.soscisurvey.de/followup/?r=%caseNumber%');

At the second of the second questionnaire the participant would then be asked if they would like to evaluate another stimulus. Here, the reference (i.e. the case number from the first questionnaire) would have to be submitted, instead of the case number:

redirect('https://www.soscisurvey.de/followup/?r=%reference%');
en/create/functions/casenumber.txt · Last modified: 24.01.2015 15:23 by alexander.ritter
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki