0 votes
in SoSci Survey (English) by s210296 (270 points)

Hi,

I put a quota to survey
Pls let know where I get inform about quota.
Thx in advance.

1 Answer

0 votes
by SoSci Survey (327k points)

You can create another questionnaire, basically using the PHP code from your quota, and show the counts via html().

You can also download the data and run the scripts from your stats software to get the quotas.

by s210296 (270 points)
Many thx for your response.

One question to your first option:
Means I have to create a questionnaire, add one page with PHP code
and I will see the result in preview view?
2nd question: How will be my PHP code?
Looking forward to hearing form you
by SoSci Survey (327k points)
> Means I have to create a questionnaire, add one page with PHP code
and I will see the result in preview view?

Not automatically. You will have to put some statistic()-lines on that new page in the new questionnaire, and use html() to display the stats:

> How will be my PHP code?

Let's say, this is your code in the quota-check:

$casesAge    = statistic('count', 'SD03_01', $ageGroup);
$casesGender = statistic('count', 'SD03_02', $gender);

Now, you have 3 age groups (1-3) and 2 gender groups (1-2), then your quota-view-PHP may look like this:

foreach ($ageGroup in [1,2,3]) {
  html('<p>Age group '.$ageGroup.' = '.statistic('count', 'SD03_01', $ageGroup).'</p>');
}
foreach ($gender in [1,2]) {
  html('<p>Gender '.$gender.' = '.statistic('count', 'SD03_02', $gender ).'</p>');
}
by s210296 (270 points)
I have in the original questionaire AB following

PHP-CODE
$quotaIND = [
  1 >= 195,
  2 >=1950
];


$IND = value('ZS30');

$casesIND   = statistic('count', 'ZS30');
debug($casesIND);

if (($casesIND >= $quotaIND))
{
 redirect('https://survey.maximiles.com/quotasfull?p=89490_f1bc75ab&m=%reference%');
};

I have put now in the new questionaire XY following

PHP CODE:
foreach ($IND in [1,2]) {
  html(<p>IND $IND = statistic('count', 'ZS02', $OKR)</p>);
}



Warning: in the new quesitionaire XY
Warnung
Warnung: Unerwartetes Element: in - fehlt hier vielleicht ein Semikolon (;) oder Anführungszeichen?
foreach ($IND in

Warnung: Unerwartetes Element: $IND - fehlt hier vielleicht ein Semikolon (;) oder Anführungszeichen?
html(<p>IND $IND

There must be sth wrong with the synatx, or what do you think?
by SoSci Survey (327k points)
> $casesIND   = statistic('count', 'ZS30');

I do not think that this will work properly ... what have you stored in ZS30 ?

If it actually works, then your PHP code for the stats was quite simple:

$casesIND   = statistic('count', 'ZS30');
html('<p>Cases IND: '.$casesIND.'</p>');

> Warnung: Unerwartetes Element: in - fehlt hier vielleicht ein Semikolon (;) oder Anführungszeichen?

Da fehlen die Anführungszeichen:

html('<p>IND $IND = '.statistic('count', 'ZS02', $OKR).'</p>');
by s299132 (170 points)
Hi, sorry for butting into the discussion, I am sure it has been resolved since then, but thought it might be useful to add a working code here, if anyone needs a clear, simple solution.

The basic setup is that you operate with two questionnaires. One is your "base" questionnaire, where you record all quota related info (and in general, where you have your sruve) and then you have a second questionnaire that is for internal use to "count" the quotas.

Code in Base Questionnaire:
// Pages where quota is set up.  SA01 is direct question about gender, and QU01_01 is internal variable to save info from SA01, IF respondent arrives to last page.

<!-- Page 1 -->
//Adds internal variable Q01_01 to questionnaire
<question id="QU01" intID="93" />

<!-- Page 2-->
//Creates quotas and manages if quotas are fill
$quotaGender = [
  1 => 50,  // 1 Women (Code 01)
  2 => 50,   // 0 Men (Code 02)
];


$gender = value('SA01');
$maxPerGender = $quotaGender[$gender];
$casesGender = statistic('count', 'QU01_01', $gender);

if ($casesGender >= $maxPerGender) {
redirect('EXTERNAL LINK');
}

<!-- Page 4-->
// Note: there needs to be a page with a "normal" question between pages of quota definition and put() command
$gender = value('SA01');
put('QU01_01', $gender);


Code in "Counting" Questionnaire:
//Essentially a single page that gives the information. In the html I manually added the number of cases I would want to reach in brackets.
// Gender-Information
$casesGender1 = statistic('count', 'QU01_01', 1);
$casesGender2 = statistic('count', 'QU01_01', 2);

html('<p><b>Gender Quotas</b></p>');
html('<p>Female '.$casesGender1.' (50)</p>');
html('<p>Male '.$casesGender2.' (50)</p>');
by SoSci Survey (327k points)

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

...