Both sides previous revisionPrevious revisionNext revision | Previous revision |
en:create:functions:id [11.07.2017 00:21] – [Rückgabewert] baeuchler.ines | en:create:functions:id [18.02.2019 11:15] (current) – martijn.millecamp |
---|
''string **id**(string //question identifier//, integer //Item//)'' | ''string **id**(string //question identifier//, integer //Item//)'' |
| |
The function ''id()'' is generating a formally correct qestion- or item identifier out of single statements about the category, question and (optional) item. This question- or item identifier can be used e.g. in ''[[value]]'' or ''[[put]]''. The function can be helpful, when the item identifier is specified as a number, like e.g. ''1'' instead of ''01''. | The function ''id()'' is generating a formally correct question- or item identifier out of single statements about the category, question and (optional) item. This question- or item identifier can be used e.g. in ''[[value]]'' or ''[[put]]''. The function can be helpful, when the item identifier is specified as a number, like e.g. ''1'' instead of ''01''. |
| |
| |
===== Example ===== | ===== Example ===== |
| |
Im folgenden Beispiel werden jene Optionen einer Skalenbatterie SK01 aufgelistet, welche vom Teilnehmer min. mit 3 bewertet wurden (z.B. auf einer fünfstufigen Skala). Dabei soll in Klammern jeweils die Bewertung angezeigt werden. Die Bewertung wird mittels ''[[value]]'' abgerufen. Die dafür nötige Variablen-Kennung (die hier der Item-Kennung entspricht) wird mittels ''id()'' erzeugt. | The following example lists options within a scale SK01, which were rated with a min. value of 3 from the participant (e.g. on a scale of 1 to 5). The evaluation should be shown in brackets. The evaluation is generated by ''[[value]]''. The therefore necessary variable-identifier (which matches the item-identifier) is generated with ''id()''. |
| |
| |
<code php> | <code php> |
// Items mit Bewertung 3+ finden | // find items with evaluation 3+ |
$items = getItems('SK01', 'min', 3); | $items = getItems('SK01', 'min', 3); |
// Alle Items durchgehen | // go through all items |
foreach ($items as $item) { | foreach ($items as $item) { |
// Text ermitteln | // identify text |
$text = getItemtext('SK01', $item); | $text = getItemtext('SK01', $item); |
// Wert ermitteln | // identify value |
$wert = value(id('SK01', $item)); | $wert = value(id('SK01', $item)); |
// Im Fragebogen anzeigen | // show in questionnaire |
html('<p>'.$text.' ('.$wert.')</p>); | html('<p>'.$text.' ('.$wert.')</p>); |
} | } |
</code> | </code> |
| |