Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Include Page
Training_Page_Header
Training_Page_Header
 

This refers to Moodle 3.4 8 from December 2018 September 2020 onward

How to: create a database activity

Stage 1: Set up the database

  1. Login to your module and click on the the'Turn editing on button (top right). Turn editing on buttonImage Modified
  2. In the relevant section, click on the + Add an activity or resource hyperlink and choose Database Image Removed hyperlink 
  3. A window will open. Select 'Database' and click on 'Add'

Add an activity or resource windowImage Added

3. In General Settings, add the "Name" of the database (which will display on the main module page) and "Description", e.g., to include specific directions on how students might contribute if they are expected to.

...

Adding details on new databaseImage Added

4. (Optional) If you want to add a restriction, click on 'Add restriction' within the "Restrict Access" section. This will open a window, select the restriction you want to add or click on 'Cancel'

Add restriction windowImage Added

5. Click on the 'Save and display'

...

 button to see the database and start setting it up as below

...

(or 'Save and return to module' to go to module front page or 'Cancel

...

')

6. Click on the 'Turn editing off' button on your main Moodle page

Other settings

You can also add settings to:

  • "Entries": Set teacher approval for database entries to be viewable, allow comments, maximum entries, set entries required for completion of the activity or before students can view the entries of others.
  • "Availability": Similar to restrict access
  • "RSS": Add entries to RSS feed
  • "Grade": Controls the category in which this activity's grades are placed in the gradebook.
  • "Ratings": Allow users to rate items

...

You create a database by defining a set of fields that make up the database template. Each Field created will have a name and description. (Note that if you later edit the fields in a database template you must click on the Templates tab and use the 'Reset template' button, or manually edit the template, to ensure the new fields are added to the display.)

  1. Open your database. For a new database, the Fields window will open automatically.

...

  1. If not, click on the Fields tab.

Opening a new empty database in Fields tabImage Added

2. Under Create a new field dropdown. Choose to select the type of field

Field types include: Image Removed

  • Checkbox - This allows you to offer checkboxes for the user to select. Add the options one under the other. The word will appear next to a checkbox when the user clicks to add an entry. They can check more than one box.
  • Date - This allows a user to enter a date by picking a day, month and year from a drop down list.
  • File - Users can upload a file from their computer. If it is an image file then the picture field may be a better choice.
  • Latlong - This allows users to add a location via link out services such as Google Maps.
  • Menu- The text entered in the options area will be presented as a drop-down list for the user to choose from. Each line become a different option.
  • Multimenu - The text entered in the options area will be presented as a list for the user to choose from and each line become a different option. By holding down control or shift as they click, users will be able to select multiple options. This is a fairly advanced computer skill so it may be wise to use multiple checkboxes instead.
  • Number - This allows users to enter any number.
  • Picture - This allows a user to upload and display an image file. "Single view" is when the image is viewed on its own; "list view" is when it is viewed in with other images. Single view can be larger than list view.
  • Radio button - The user gets radio buttons and can choose only one. They can only submit the entry when they have clicked on one button. (Note:If you only have two options and they are opposites (true/false, yes/no) then you could simply use a single checkbox instead. However checkboxes default to their unchecked status and so people could submit without actively selecting one of the options. This may not always be appropriate.)
  • Text area - This allows users to enter a longer piece of text using the text editor.
  • Text input - Users can enter short amounts of text up to 60 characters in length. For longer text, or for text that requires formatting such as headers and bullet points, you can use a text area field.
  • URL - The user can add a link to a website here. If you select autolink then the URL becomes clickable.. If you also enter aforced name for the linkthen that text will be used for the hyperlink. For example in a database of authors you may wish people to enter the author's website. If you enter the text 'homepage' as a forced name then clicking on text "homepage" will take you to the entered URL.

3. Add names, descriptions and any other parameters to the fields and click 'Add'

Adding a date fieldImage Added

4. Continue doing this for as many fields as you need adding fields.

You can choose which of the fields is used to sort the entries (by default they are listed by time created/added)

...

Click on the Templates tab. The List template and Single template define the way the database entries are displayed (there are other templates too, probably not needed for basic databases). Once you've defined the fields in step 2 you can often accept the default  templates templates without having to change anything. (More information on the Moodle site here)

Click Save templatefor each (normally  List Template, Single Template and Add are Template are the only ones needed)

Template tabImage Modified

Stage 4: Add or import entries

It's usually a good idea at this stage to add your first entry or a test entry. You will need to go to the Add Entry tab of your database to do this

Adding an entry to a databaseImage AddedImage Removed

You can import multiple entries via a CSV file if you click the "Import entries" link in the Database activity administration block. The easiest way to determine the format of the text file is to manually add an entry to the database and then export it. The resulting export text file may then be edited and used for importing entries.

Image RemovedImage Added

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.

Example

drug_name,action,category

...

Do not put spaces after your commas or upload will fail!

To import a files:

  1. Click on the 'Cogwheel' within your database and select 'Import entries'

Import entries in cogwheel menu of databaseImage Added

2. Find your file to upload and click on 'Submit'

Adding a file to importImage Added

3. It will then confirm that your entries have been imported. Click 'Continue'

Import entries (as below).  After upload if successful you'll read a message such as "10 entries saved".Image RemovedImage Added

See also

Content by Label
showLabelsfalse
showSpacefalse
cqllabel = "moodle_database"
labelsmoodle_database