Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
en:create:functions:getitems [28.11.2014 12:45] – [getItems()] alexander.ritter | en:create:functions:getitems [28.11.2014 12:48] – [Use Selected Items in Another Question] alexander.ritter |
---|
|'''invalid'''|items left empty or given an answer of "do not know".| | |'''invalid'''|items left empty or given an answer of "do not know".| |
| |
**Note:** As is the case with ''value()'', this function can only determine the answers of a participant on the page after the question. If the function is on the same page as the question, it does not work correctly because the answers will not have been transmitted to the server at all when the "continue" button is pressed. | **Note:** As is the case with ''value()'', this function can only determine the answers of a participant on the page after the question. If the function is on the same page as the question, it does not work correctly because the answers will not yet have been transmitted to the server when the "next" button is pressed. |
| |
===== Use Selected Items in Another Question ===== | ===== Use Selected Items in Another Question ===== |
In the following example, question ''AB01'' (a matrix question -- scale) is asked on page 1, in which the participant has to specify how often they read different magazines. | In the following example, question ''AB01'' (a matrix question -- scale) is asked on page 1, in which the participant has to specify how often they read different magazines. |
| |
On the following page 2, only items used no less frequently than "rarely" (answer code 2) should be displayed. | On the following page 2, only items used at least "rarely" (answer code 2) should be displayed. |
| |
This example assumes that ''AB02'' has just as many items as ''AB01''. In addition, matching items must also have the same ID. Thus, item 1 could be "mirror" in both questions, and item 2 could be "star". | This example assumes that ''AB02'' has just as many items as ''AB01''. In addition, matching items must also have the same ID. Thus, item 1 could be "mirror" in both questions, and item 2 could be "star". |
<code php> | <code php> |
// page 2 | // page 2 |
// determine items used no less frequently than "rarely" (2) | // determine items used at least "rarely" (2) |
$itemlist = getItems('AB01', 'min', 2); | $itemlist = getItems('AB01', 'min', 2); |
// only show these items in AB02 | // only show these items in AB02 |