Inhaltsverzeichnis

valueSum()

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.

Examples

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(
         array(
           'AB01_01',
           'AB01_03',
           'BB01_02'
         )
       );