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:databank [14.01.2015 21:22] – [Database for Contents] alexander.ritteren:create:databank [26.11.2020 20:59] – [Example 4: Relay A Priori Data] sophia.schauer
Line 11: Line 11:
 In addition to this, the question types [[:en:create:questions:extselect|Extended Selection]] and [[:en:create:questions:suggest|Suggesting Text Input]] offer the possibility to access the database. This enables the programming of very extensive and/or dynamic selection questions.  In addition to this, the question types [[:en:create:questions:extselect|Extended Selection]] and [[:en:create:questions:suggest|Suggesting Text Input]] offer the possibility to access the database. This enables the programming of very extensive and/or dynamic selection questions. 
  
-The commands ''[[:en:create:functions:dbget|dbGet()]]'' and ''[[:en:create:functions:dbset|dbSet()]]'' are used to access the database through PHP code. The data is read to a key with ''dbGet()'' and data can be written to the database with ''dbSet()''The keys available can be listed with the command ''[[:en:create:functions:dbkeys|dbKeys()]]''.+The commands ''[[:en:create:functions:dbget|dbGet()]]'' and ''[[:en:create:functions:dbset|dbSet()]]'' are used to access the database through PHP code. The data is read to a key with ''dbGet()'' and data can be written to the database with ''dbSet()''Available keys can be listed with the command ''[[:en:create:functions:dbkeys|dbKeys()]]''.
  
 **Note:** Please note: when the project is exported, the data in the **Database for Contents** will __not__ be exported yet. When a project is archived, the data will be deleted rather than archived. Changing this is planned in the next version of the programme.  **Note:** Please note: when the project is exported, the data in the **Database for Contents** will __not__ be exported yet. When a project is archived, the data will be deleted rather than archived. Changing this is planned in the next version of the programme. 
Line 40: Line 40:
 ===== Import Data ===== ===== Import Data =====
  
-First of all, the data has to be stored in a table, e.g. in excel or Open Office Calac:+First of all, the data has to be stored in a table, e.g. in excel or Open Office Calc:
   * the first column must contain the key   * the first column must contain the key
   * the other columns contain the data   * the other columns contain the data
Line 131: Line 131:
 ===== Example 3: Relay Analysis  ===== ===== Example 3: Relay Analysis  =====
  
-In a survey, participants have to fill in several lengthy scales. As a thank-you, they can look at an analysis of their results two weeks later. The analysis cannot be conducted live (''[[:en:create:functions-stat#valuemean|valueMean()]]'', [[:en:create:points|Count Points for Answers]]) because the standard values from the sample have to be determined first of all. To call up their results, the participants have to note down a code because the survey is conducted anonymously.+In a survey, participants have to fill in several lengthy scales. As a thank-you, they can look at an analysis of their results two weeks later. The analysis cannot be conducted live (''[[:en:create:functions:valuemean|valueMean()]]'', [[:en:create:points|Count Points for Answers]]) because the standard values from the sample have to be determined first of all. To call up their results, the participants have to note down a code because the survey is conducted anonymously.
  
 Therefore, an 8-digit random code is created in the first questionnaire, saved in the database and displayed: Therefore, an 8-digit random code is created in the first questionnaire, saved in the database and displayed:
Line 199: Line 199:
 // now show the question  // now show the question 
 question('ST01'); question('ST01');
 +</code>
 +
 +===== Example 5: Complete Data =====
 +
 +To add an entry to the database for content during the interview, it must be read out, added and then written again.
 +
 +For example, under the key "FS-<Serial number>" a-priori data was stored (3 entries per person, i.e. indices 0 to 2). In survey wave 1 a product preference from question PP01 is now to be added as fourth date (index 3). The following PHP code could then be placed on the page __after__ the page with PP01 (see notes on ''[[:en:create:functions:value]]'')
 +
 +<code php>
 +$key = 'FS-'.caseSerial();
 +// Reading data
 +$data = dbGet($key);
 +if ($data === false) {
 +  // No data found - maybe show warning
 +  $data = array(-8, -8, -8);  // ... and initialize the data element
 +}
 +// Add the answer from PP01
 +$data[3] = value('PP01');
 +// save entry again
 +$data = dbSet($key, $data);
 </code> </code>
en/create/databank.txt · Last modified: 21.04.2024 20:21 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