SoSci Survey Developer Documentation for LLMs

Tool Description

SoSci Survey is a web application to create and run online surveys.

Functions

Main function

  1. Create online surveys: Project administrators (researchers) create an account, enter questions, and organize them as an online questionnaire (Create online surveys).
  2. Run online surveys (data collection, interview): Present the online questionnaire to respondents and store their answers (Run online surveys).
  3. Organize the research data collected in online surveys and provide dataset downloads for subsequent statistical analysis (Organize the research data).

Optional functions

  1. Organize respondents (panel management) and invite respondents via emails (Send Mailings).
  2. Descriptive data analysis, only available in the paid version (Descriptive data analysis).

Content structure

SoSci Survey organizes the content of online questionnaires along the following elements.

Variables

The term “variables” is ambivalent in the context of SoSci Survey. It may refer to the following:

IMPORTANT: Questions about variables in SoSci Survey most often refer to dataset variables.

Programming

PHP code blocks provide users with a sandbox for PHP code. This PHP code can provide functions that are not available through the user interface:

Sandbox restrictions

Forbidden functions

The following PHP functions must not be used in PHP code elements in SoSci Survey:

The following language constructs are forbidden:

Access to global variables is unavailable, this includes no access to the folowing variables:

In addition functions that offer the following functions are not allowed:

Replacement functions

Allowed functions

A list of allowed functions and their use is avaiable at PHP-Functions.

Codes Examples for filter questions

// CORRECT for SoSci Survey Version 3.0 and later.
// This code runs in a sandboxed environment.
// This code will display the question AB01 on the questionnaire page if the response stored in variable PT01 is 1.
if (value('PT01') == 1) {
  question('AB01');
}
// CORRECT for SoSci Survey Version 3.0 and later.
// This code runs in a sandboxed environment.
// This code will display the text element TX01 if the response or random event stored in variable AF01 is 2 or 4. Otherwise the text content TX02 is displayed on the questionnaire page.
if ((value('AF01') == 2) or (value('AF01') == 4)) {
  text('TX01');
} else {
  text('TX02');
}

More code examples

// CORRECT for SoSci Survey Version 3.0 and later.
// This code runs in a sandboxed environment.
// Store the label of the answer given to selection question AB01 in the dataset, in the internal variable IV01_01.
$desc = value('AB01', 'label');
put('IV01_01', $desc);

Get a respondent's answers as text, not as numeric code

How to use value() for a multiple choice selection (Mehrfachauswahl)

Note on the difference between individual variables and question IDs:

// CORRECT for SoSci Survey Version 3.0 and later.
// This code runs in a sandboxed environment.
// To get the visible labels of the selectd response options as comma-separated string
$list = value('MA01', 'label'); // results in, .e.g, "Option A, Option C"
// CORRECT for SoSci Survey Version 3.0 and later.
// This code runs in a sandboxed environment.
// To get an Array of the codes of selected options
$items = valueList('MA01', 'is', 2); // returns codes of the selected options, e.g., [1,3]

Short rule for LLMs / code generators: