This translation is older than the original page and might be outdated. See what has changed.
Translations of this page:


float valueSum(string question)

float valueSum(string question, string|array items)

float valueSum(array variables)

Calculates the sum of the answer codes for all items in a question (e.g. a scale), for selected items, or for a list of variables.

  • question – ID of a question (as a string)
  • items – A list (string or array) of items e.g.
    • array(2,4,6)
    • '1-3,5,7'
  • variables – A list (array) of variable IDs, as stated in the Variables Overview e.g.
    • array('AB01_01', 'AB01_02', 'BB01', 'BC01')


Calculate the sum of all responses in scale AB01.

$sum = valueSum('AB01');

Sum of items 2, 4, 6 and 8 in scale AB01.

$sum = valueSum('AB01', array(2,4,6,8));

Sum of the first 4 items in scale AB01.

$sum = valueSum('AB01', '1-4');

Sum of responses in variables AB01_01, AB01_03 and BB01_02.

$sum = valueSum(array('AB01_01','AB01_03','BB01_02'));

The same command written a little more clearly:

$sum = valueSum(
en/create/functions/valuesum.txt · Last modified: 24.01.2015 16:21 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