55m5Hj40-FBKYQwLn-tRcBAUJn-5mF8ArS0
0wDcxXUD-myDUR6RD-6Atr9Qse-XJEwRN61
QmmWWJgJ-8A8vuCcX-Llc2a10t-pDCqUSie
ANVE251r-pqT5Rerm-oU30Ujzq-BHibeuZA
EENIjrr1-35rTXjxr-qsiTa8dk-YPVVx42i
PMt5KNjZ-MoN3Fj5Q-Lmgl4Viz-hAQYKXvG
55m5Hj40-FBKYQwLn-tRcBAUJn-5mF8ArS0, 0wDcxXUD-myDUR6RD-6Atr9Qse-XJEwRN61, QmmWWJgJ-8A8vuCcX-Llc2a10t-pDCqUSie, ...
"55m5Hj40-FBKYQwLn-tRcBAUJn-5mF8ArS0",
"0wDcxXUD-myDUR6RD-6Atr9Qse-XJEwRN61",
"QmmWWJgJ-8A8vuCcX-Llc2a10t-pDCqUSie",
"ANVE251r-pqT5Rerm-oU30Ujzq-BHibeuZA",
"EENIjrr1-35rTXjxr-qsiTa8dk-YPVVx42i",
"PMt5KNjZ-MoN3Fj5Q-Lmgl4Viz-hAQYKXvG"
During import, the raffle with number 1 is preselected. Change the preselection if you want to manage the vouchers separately from other coupon codes.
===== Issuing Coupon Codes =====
To select voucher codes, use the''voucher()'' function.
''string|NULL **voucher**(string //person_id//, [int //draw//], [bool //new_draw//])''
* //person_id// -- A unique identifier for the person receiving the voucher
* //draw// -- (optional) The number of the draw from which the voucher code should be selected
* //new_draw// -- (optional) Should a voucher code be drawn for the person ID if none has been drawn for that ID in this drawing yet (Standard: ''true''). If set to ''false'' and no code has been drawn for the person ID in the drawing, the return value is ''null''.
The ''voucher()'' function always returns the same voucher code for a given combination of person ID and raffle. The page containing the voucher code can therefore be displayed multiple times. You can also provide a separate questionnaire where respondents can view the voucher code again.
If no voucher codes are available in the specified raffle, the function returns ''null''.
**Note:** If you are testing the questionnaire as a project manager, the ''voucher()'' function will only return a dummy voucher code (e.g. ''EXAMPLE-123456-7890''). Real voucher codes are used only for interviews (MODE=interview).
==== Displaying a Coupon Code in the Questionnaire ====
The person ID from the address entry in a mass email campaign (SERIAL) or a participation code can be used as the person ID. Both are available via ''caseSerial()''.
$person = caseSerial();
$voucher = voucher($person);
html('Your Voucher Code is: '.$voucher.'
');
If another voucher is to be issued to the same person in a later survey wave, import voucher codes for drawing No. 2 and specify the number 2 in the ''voucher()'' function:
$person = caseSerial();
$voucher = voucher($person, 2);
html('Your Voucher Code for Wave 2 is: '.$voucher.'
');
Take into account the possibility that all coupon codes will be used up during the survey.
$person = caseSerial();
$voucher = voucher($person);
if ($voucher) {
html('Your Voucher Code is: '.$voucher.'
');
} else {
html('There are no more Voucher Codes available. Please contact us at ....
');
}
In public questionnaires, the case number can also be used as a personal identifier. However, be sure to prevent bots from automatically filling in the form.
// Only use this variant with great care!
$person = 'C'.caseNumber();
$voucher = voucher($person);
html('Your Voucher Code for this interview is: '.$voucher.'
');
==== Showing a Coupon Code again ====
If respondents did not write down the code, you can create an additional questionnaire that displays the coupon code again. To do this, set the third parameter of the ''voucher()'' function to ''false''. This ensures that someone who did not complete the original questionnaire — and therefore did not receive a coupon — cannot obtain one through this “shortcut.”
$person = caseSerial();
$voucher = voucher($person, 1, false);
html('Your Voucher Code from Wave 1 is still: '.$voucher.'
');