====== Display Individual Codes or Coucher Codes ====== This chapter describes different ways of displaying an individual code to the participants (e.g. at the end of the questionnaire). Possible applications for this are: * an anonymous reference to the questionnaire/the participant's answers * distribution of unique codes (one-time passwords), which are recognized e.g. as test person hours or on a crowdsourcing marketplace (e.g. [[https://en.wikipedia.org/wiki/Amazon_Mechanical_Turk|Amazon Mechanical Turk]]) as confirmation for filling out * distribution of voucher codes (e.g. shopping vouchers) as incentives ===== Show Record Reference ===== If it is only a matter of giving the participant a reference to his record, the interview number is usually sufficient. For example, if you want to give participants the opportunity to receive individual advice later. The number of the data set (CASE, see [[:en:results:variables|additional variables in the data output]]) can be easily displayed using the [[:en:create:placeholders|placeholder]] ''%caseNumber%''. You might want to add a letter in front of it, as in the following HTML code: D%caseNumber%

===== Assign Individual Codes ===== The prerequisite for this is that you have received individual codes in advance (e.g. voucher codes) or have created them (e.g. using the [[:en:survey:mailing#serial#numbers|access code function]] of SoSci Survey at **Send invitations** → **Access Codes** → //administration//). Now create a question of type "random number generator" and copy the codes (one code per line) into the field //ballots//. For //type of draw//, please keep the default value "Equally distributed draw (draw without put back)". A small filter ensures that the questionnaire will display an error message if there are no more codes in the random number generator. If all the codes of a random generator have been drawn, then it's ID with the postfix "_CP" will deliver "1". If there are still codes in there, then this value will return "0" (see an example below). The following example assumes that the random number generator has the code "RG01" and the text with the error message has the code "RG02". // If the random number generator has already been emptied completely if (value('RG01_CP') > 0) { text('RG02'); } else { // Store code in placeholder %code% store replace('%code%', 'RG01', 'response'); // display HTML code with the code (alternatively: include text with the placeholder %code%) html('

your code is: %code%

'); }
**Note:** If you distribute voucher codes, make sure that only authorized participants access the questionnaire. The [:en:survey:mailing|mailing feature]] can be used for this purpose. **Tip:** Check with ''[[:en:create:functions:casetime|caseTime('hitherto')]]'' and ''value('MISSING')'' if the participant has earned the code at all. ---- Search terms: Completion code, voucher, tokens, confirmation of participation