Dataform Import Export
- Overview
- Activity administration
- Building an activity
- CSS tips and tricks
- JS tips and tricks
- Activating RSS
- Activity workflow
- Grading
CSV
You can import and export Dataform entries in a csv format via a CSV view. You can have multiple import/export templates in an activity by adding multiple instances of CSV view type and setting each instance to include the desired subset of activity content. With view level access control you can control who can import/export and what content.
CSV means Comma-Separated-Values and is a common tabular format for text interchange. CSV formatted text can look something like:
name,height,weight Kai,180cm,80kg Kim,170cm,60kg Koo,190cm,20kg
Import
You can add new entries to a Dataform activity by importing their content from a csv file or csv text. The import form will display all the field patterns from the Entry template that are import-applicable and for each pattern additional import settings. You can either upload a csv file to the filepicker or paste csv formatted text into the 'CSV Text' field. The expected file format is a plain text file with a list of field names as the first record. The data then follows, one record per line. The field delimiter defaults to a comma character and the field enclosure is not set by default (field enclosures are characters that surround each field in each record). The CSV records should be delimited by new lines (usually generated by pressing RETURN or ENTER in your text editor). Tabs can be specified using \t and newlines by \n.
Do not put spaces after your commas or upload will fail!
Export
When using the CSV format, the user can select either the comma, semicolon, or tab to separate the fields. The selection of the proper character is important. If users select to use a comma to separate the fields and some of the fields contain data with commas then the number of columns is going to be misaligned and likely cause confusion.
The content to export is determined by the field tags you include in the view template. The subset of entries export can be controlled by applying available filters to the export view.
To export the displayed entries in the export view, click on the Export pushbutton. You will usually have the option of either opening or saving the file.
Fields' options
(This list includes only internal and standard fields. For csv import options of add-on fields please consult the respective field's page)
Field | Import | Export |
Entry actions | None | What you see is what you get. |
Entry author | Importing entry author info allows for adding entries on behalf of users. You can use either one of the following patterns provided that the respective user attribute (id, idnumber, username) is unique in your Moodle site.
|
What you see is what you get. |
Entry group | Importing entries with group info allows you to add entries for specific groups. You can use either one of the following patterns. Currently you can import group info for an entry even if the designated entry author is not a member of that group.
|
What you see is what you get. |
Entry time | Importing entries with entry time info allows you to add entries with specific time created and modified. When both time created and time modified are imported, if time modified is earlier than time created it will be adjusted to the time created.
The imported value can be a string containing an English date/time (including relative date/time such as 'tomorrow') or a Unix timestamp.
|
What you see is what you get. |
Checkbox | By default only options that exist in the field configuration will be imported. If you set 'Allow adding options' to Yes, options which do no exist in the field configuration will also be imported and added to the configuration. Multiple options should be separated by #.
Applicable patterns:
|
What you see is what you get. |
Entry state | Imports entry states by state label. For example, with an entrystate field that contains the states Submitted, Under review, Reviewed, Accepted and Rejected, the import CSV value can be either Submitted, Under review, Reviewed, Accepted or Rejected. Note that since Submitted every new entry is by default in that state and there is no need to import it explicitly.
Applicable patterns:
|
What you see is what you get. |
File | You can import entries with file field content. The field import settings allow you to upload a zip file with the content files. The imported value in the csv should be a comma delimited list of file names. For each imported entry, if the zip file contains files with the specified file names, these files will be added to the entry content. If imported entries specify the same file names, each entry will have its own copies of the imported files.
Applicable patterns:
|
What you see is what you get. |
Comment Mdl | None | What you see is what you get. |
Number | Imports numbers, e.g. 42, 42.6778, -133.
Applicable patterns:
|
What you see is what you get. |
Picture | You can import entries with images. The field import settings allow you to upload a zip file with image files. The imported value in the csv should be a comma delimited list of file names. For each imported entry, if the zip file contains files with the specified file names, these files will be added to the entry content. If imported entries specify the same file names, each entry will have its own copies of the imported files.
Applicable patterns:
|
What you see is what you get. |
Radio button | By default only options that exist in the field configuration will be imported. If you set 'Allow adding options' to Yes, options which do no exist in the field configuration will also be imported and added to the configuration.
Applicable patterns:
|
What you see is what you get. |
Rating Mdl | None | What you see is what you get. |
Select | By default only options that exist in the field configuration will be imported. If you set 'Allow adding options' to Yes, options which do no exist in the field configuration will also be imported and added to the configuration.
Applicable patterns:
|
What you see is what you get. |
Select (multiple) | By default only options that exist in the field configuration will be imported. If you set 'Allow adding options' to Yes, options which do no exist in the field configuration will also be imported and added to the configuration. Multiple options should be separated by #.
Applicable patterns:
|
What you see is what you get. |
Text | Imports plain text, e.g. Hello world, Dataform.
Applicable patterns:
|
What you see is what you get. |
Text area | Imports multi-line text, either plain or html. For importing html, the field should be configured to enable editor. For example, the import value
<span style="background-color:#006699;color:#FFF">Big Blue Marble</span> would be imported as such and displayed as Big Blue Marble when the field enables editor, and as simple text Big Blue Marble if editor is not enabled in the field. Applicable patterns:
|
What you see is what you get. |
Time | The imported value can be a string containing an English date/time (including relative date/time such as 'tomorrow') or a Unix timestamp.
Applicable patterns:
|
What you see is what you get. |
Url | Imports valid urls, e.g. moodle.org, www.substantialmethods.com.
Applicable patterns:
|
What you see is what you get. |
Portfolios
Export
TBC