Nicolas Dunand
Lead maintainer
A simple filter allowing the use of the Database activity to use data sets in Moodle. These data sets are mapped to users using course groups.
The first intended usage was to provide data sets for questions from Moodle's question engine, as described in the Usage section below.
datasetname;itemname;"fieldname";..;..For each dataset, there should be `n` items. Supposing there are `m` datasets, there would be `n * m` records in the CSV file / the Database activity. This step can also be done by manually creating records in the Database activity.
For instance, to use the item named "item1", and display the "data1" field from the user's current dataset, using datasets defined in the Database activity named "datasets", the syntax would be:
{{datasets:item1:data1}}
This would display the same item's "data1" value to different users, pulling the data from the data set maxqtching the user's group name.
The number `N` of question answers can be as big as necessary to account for the question with the most answering options.
datasetname;questionname;"questiontext";answer1;..;answerN
For each dataset, there should be `n` questions. Supposing there are `m` datasets, there would be `n * m` records in the CSV file.
`{{questiondata:questionname:database_field}}`
For instance, to use the question named "question1", and display the "questiontext" field, the result would be:
`{{questiondata:question1:questiontext}}`
In the case of a MCQ, for the proposed answer 1, the syntax would be:
`{{questiondata:question1:answer1}}`
Usage as described in this example would display the same "question1" to all users, but pulling the actual question description ("questiontext") and proposed answers ("answer1" to "answerN") from the database activity entry corresponding to the data set assigned to the user.