Valid for Moodle 2.8. Updated on 7/30/2015.The database has proven to be a very popular way of collecting information from students. For example, in one course the database was used to compile an annotated list of web sites. In another it was used for people to submit paper proposals in a way that other users could see and comment on. Unlike forums, it is possible to hide the author of individual entries although they aren’t truly anonymous.
- Defining the Database Activity
- Defining Fields
- Display Templates
- Adding Data
- Viewing Data
- Export/Import Entries
- From your course page, turn editing on and go to the Topic or Week in which you want to add the database.
- Click on the Add an activity drop-down box and select Database to get the factivity list or, if you are using the activity chooser, click on Add an activity or resource link and select Database . Detailed descriptions of most of the fields are provided below the following image of the form, but in most cases the default values are fine.
- The database name will be the link students use to access the database activity. The description is required. You may want to use the description to tell your students what should go into the various fields
- Approval required allows you to evaluate entries before other students see them.
- If you want students to be able to comment of each other's entries, use All comments on entries.
- The Entries required for completion values can be ignored since we currently don’t support completion reporting.
- With Entries required before viewing you can require that your students add a minimal number of entries to the database before they can see what other students have submitted.
- You can use Maximum number of entries to limit the number of entries any individual student can add.
- The Availability section controls when students can see and make entries to the data base.
- The Grade section determines which gradebook category should contain the database item.
- The Ratings section allows entries to be rated. We don’t have any experience with rated databases.
- Common module settings and Restrict access sections are standard activity options. Most of the time the default values will be fine. With a database you may want to hid the activity until you’ve finishing defining the fields and setting up the database display.
- When done click one of the two save buttons at the bottom of the page.
Once you’ve defined the database, it will show up in the course. However, until data fields are defined, your students can't do anything with it. By clicking on database name you will bring up a page with a variety of tabs. (If some of the tabs overlay each other, as in this example, widen your browser window to get them all to display on one line). As an instructor you have more fields than your students. The first time you go to the database you'll need to define the fields. In this example we're looking at a database called URL Database.
Click on the Fields tab and then on the pull-down menu under Create a new field. This will allow you to select what type of field to create.
The field type controls what kind of data is to be entered and what the user interface looks like. For example, the Menu field allows you to specify a list of values that the user must select from. Text provides a simple one line text field while Textarea displays a multiline text box. See the moodle.org documentation for a description of all the field types.
Once you’ve selected a field type the values that you enter to describe the field vary with the type of field.
In this case, a URL field, you enter a field name and a field description. If a forced link is provide, when the record is displayed, the forced link text will be displayed rather than the URL itself. If no forced link is provided then the user will be prompted for text to display. The displayed text will, in all cases, be a link.
When autolink is turned on, Moodle will search the course site looking at pages, labels, wikis and other locations for the text provided by the user for the link name and, when ever that text is found create a link that brings up the database record. You should never use the forced link field when autolink is checked. [At the moment, we haven’t been able to get autolink to work with URL fields but the option exists, and works, with Text fields.
Next you must define how the entries are to be displayed. The display layout is controlled by two templates – Single Template and List Template. In addition you can change the layout of the form needed to add entries and to search the database.
Warning: You MUST touch the Single Template even if the default values are acceptable. To do this start by clicking on the Templates tab and then the Single Template subtab. Then click Save template. This template is used when displaying one record at a time.
Warning: If you edit a database to add new fields you will probably need to manually alter the templates to make them match the new database record.
On the left you have a list of tags that you can use to define the display. On the right is a text box where you create the template. By default you get a simple table with the first column being a list of field names and the second column field values. The bottom row of the table contain action links. You can rearrange the template anyway you want including adding or removing tags as desired. When done click on the Save Template button. You must click on this button the first time you look at this page even if you haven’t changed anything.
The List template works the same as the single template except you can define a header at the top of the list and a footer at the bottom.
Advances Search Template
The advanced search template defines the search form.
By default this form allows for search by author name. If you don’t want students to be able to determine which entries belong to which student, you must remove these search fields.
The add template defines the screen used to collect the record. Here the field tags are used to indicate where the data entered is to go rather than what data should be displayed.
Now that all the fields have been defined and the templates set (and the link unhide if you had hidden it earlier) you and your students can add entries. This is done by clicking on the Add entry tab. Fill out the form and then hit the Save and view button if done or the Save and add another if you want to add additional entries.
To view what has been entered, click on either the View list or the View single tab. The list view shows you all the records. The single view only shows you one record at a time.
Use the Search tab to search the database. The search will look for partial matches and is not case sensitive. For example, a search for amh would return every record containing Amherst in the searched field. The search form looks the same as the advance search provided with the list view above.
If you try to move a database from an old course to a new one using the standard course import all you will get will be the layout and structure of the database. To import the entries you'll need to go to the source database and use the Export option to export the contents to a file. Then you will need to go to the target database and import the file. Even doing it this way, any images connected to the database will be lost. There is no way to move images from one database to another.
The Export and Import options can be reached by first going to the database activity. There will now be an database administration block inside of the Administration block. The import and export options are in this block. For the export use the CSV option. There is an export tab on the main database definition interface which does the same thing, but there isn't an import tab.