[[put()]]
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
en:create:functions:put [13.01.2015 15:36] – [Example: Advanced Filter] alexander.ritteren:create:functions:put [26.09.2020 14:32] – [put()] sophia.schauer
Line 1: Line 1:
 ====== put() ====== ====== put() ======
  
-''void **put**(string //variable//, mixed //value//)''+''void **put**(string //variable//, mixed //value//, [boolean //EachVariable//])''
  
 The function ''put'' enables you to store a single value in the data record. ''put()'' is used when the questionnaire calculates or draws a value -- and this value is needed for the analysis. For example, if the stimulus in a question is varied at random, then which one the respondent made a statement on has to be known for the analysis. The function ''put'' enables you to store a single value in the data record. ''put()'' is used when the questionnaire calculates or draws a value -- and this value is needed for the analysis. For example, if the stimulus in a question is varied at random, then which one the respondent made a statement on has to be known for the analysis.
Line 7: Line 7:
   * //variable//\\ The ID of the internal variable (see below), in which the //value// should be saved. The ID is entered as a string in quotation marks, e.g. '''IV01_01'''.   * //variable//\\ The ID of the internal variable (see below), in which the //value// should be saved. The ID is entered as a string in quotation marks, e.g. '''IV01_01'''.
   * //value//\\ A number or text (string), which should be stored in the variable. Ordinarily, a variable with the corresponding value is given as the second parameter.   * //value//\\ A number or text (string), which should be stored in the variable. Ordinarily, a variable with the corresponding value is given as the second parameter.
 +  * //EachVariable// (optional)\\ Normally, `put()` only stores in [[en:create:questions:internal|internal variables]]. In some cases it may be useful to overwrite the value of another variable. In this case a third parameter ''true'' can be specified.
 +
 +**Warning:** Only use the third parameter //EachVariable// if you know exactly what you are doing and an internal variable cannot be used. Changing response codes can invalidate the validity of the data set. For most cases the functions ''[[:en:create:functions:preset]]'' and ''[[:en:create:functions:dropvalue]]'' are much better suited.
 +
  
  
Line 49: Line 53:
 </code> </code>
  
-Determining the scale index even during the survey is particularly useful if you want to inform the participant of the result, or if it is required for a filter:+Determining the scale index during the survey is particularly useful if you want to inform the participant of the result, or if it is required for a filter:
  
  
 <code php> <code php>
 if (value('AB03_01') > 100) { if (value('AB03_01') > 100) {
-  question('FU03');  // question for people who rate the construct with a higher extent +  question('FU03');  // question for people who rate the construct higher on the scale
 } elseif (value('AB03_01') > 50) { { } elseif (value('AB03_01') > 50) { {
-  question('FU02');  // Frage für Personen mit mittlerer Ausprägung beim Konstrukt+  question('FU02');  // question for people who rate the construct averagely on the scale
 } else { } else {
-  question('FU01');  // Frage für Personen mit geringer Ausprägung beim Konstrukt+  question('FU01');  // question for people who rate the construct lower on the scale
 } }
 </code> </code>
Line 77: Line 81:
 </code> </code>
  
-The saved code can be used straightforwardly for filters on later pages+The saved code can be used on later pages for filters with no hassle.
  
 <code php> <code php>
en/create/functions/put.txt · Last modified: 11.02.2024 07:38 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki