Editing, filtering and searching data using the ORDS

Introduction

This HOW-TO describes how to edit, filter and search your data within the data interface of the Online Research Database Service (ORDS).

Pre-requisites

You need to have registered for ORDS and have created a database complete with data. This is described in previous HOW-TOs in the series.

To use ORDS you only need a web browser.

General tips about the ORDS data interface

Within the ORDS data interface there are some general things that you should note:

Back button: Your browser’s back button will allow you to navigate around the data interface. This is in contrast to the registration interface where your browser’s back button will not work.

Help text: wherever you see a field or piece of text underlined with a dotted line like this:

you can hover your mouse over the term and some help text will pop up.

Login to the data interface

The first step in being able to manipulate the data in your database in the ORDS is to login to the data interface for the database that you wish to work on.

Within the registration interface where you created the database and data interface, the project summary page will display a clickable URL for the data interface:

Click the URL to be taken to a new window that displays the data interface.

Click the Login link in the top right hand corner of the window:

A login window will pop up prompting you for your username and password:

Enter your ORDS username and password, this the same username and password that you created for the registration interface. Only tick the Remember me check box if you are the only person using this computer. Once you have entered your details Click the Login button. Once you have logged in you will see that the top navigational bar changes to indicate that you are signed in.

Editing and viewing your data

Viewing and editing your data is achieved using similar screens. Firstly we must find the data that we are interested in and then we can choose to edit or simply view it.

Navigating to the relevant table

Hover over the Browse data link found in the left half of the top navigation bar and a drop down menu will appear:

This menu will contain one link for each of the tables in your database. In the example above there are three tables: Tblarticles, Tbljournals and Tblauthors.

Click the Tblarticles menu item. This will bring up a window that displays the data within the Tblarticles table:

You will notice that the top half of the window contains a search form and the bottom half of the window displays the data in the Tblarticles table, record by record, along with links to view or edit each record. Note the Tblauthors_id and Tbljournals_id columns, these show how the records in this table link to the other tables in the database.

At this point you will need to follow the Viewing your data section if you want to view your data, and the Editing your data section if you wish to edit your data.

Viewing your data

To view a record, simply click the View link for the record you wish to view. The View link is found in the Action column on the right hand side of the screen.

This will take you to the screen that shows you the full details for that particular record, including an expansion of the links to the other tables in the database, shown above in the Tblauthors_id and Tbljournals_id columns:

The top of the screen shows the record that we have chosen from the Tblarticles table. The lower part of the screen shows the records to which this record is linked. In the example above you can see that this record is linked to both the Tblauthors and Tbljournals tables, and you can click the respective tabs to switch between displaying the Tblauthors and Tbljournals tables. (The tabs are found below the Edit and Done buttons.) In the screenshot above the Tblauthors tab is selected, click the Tbljournals tab (indicated by a red oval) to see the Tbljournals data as below:

If, after viewing the data, you wish to edit the data you can click the Edit button from this screen. This will take you to the editing screen explained in the section on Editing your data below.

Sorting

When you are in the table view for a particular table you will see that the column headings are underlined. If you want to sort the table on a particular column click that column’s heading to perform the sort. The table will then be re-displayed sorted on that column and the column heading will now contain a small arrow at the end of the column name. The arrow indicates whether the sort is ascending or descending; if you wish to reverse the order simply click the small arrow to toggle between ascending and descending sort order. The arrow indicating an ascending sort can be seen alongside the column heading Tbljournals_id in the figure below (this figure shows only a small part of a window):

Editing your data

(These steps follow on from the section on Navigating to the relevant table.)

To edit a record, simply click the Edit link for the record you wish to view. The Edit link is found in the Action column on the right hand side of the screen:

This will take you to the screen that shows you the full details for that particular record, including an expansion of the links to that other tables in the database, shown above in the Tblauthors_id and Tbljournals_id columns:

The data for the record that you have selected appears with each field in a separate box that you can edit. To edit any of these fields simply click within the box to insert the cursor and then make the edits you require. To move onto another field simply click within that field’s box to place the cursor ready for editing.

Also note that the lower part of the screen shows the records to which this record is linked. In the example above you can see that this record is linked to both the Tblauthors and Tbljournals tables, and you can click the respective tabs to switch between displaying the Tblauthors and Tbljournals tables. (The tabs are found below the Save, Delete and Cancel buttons.) This lower section also contains a button to take you directly to the table that is the currently active tab, ie in the example above the current tab is Tblauthors and so the button below is Change Tblauthors .If you wish to change your view to that table simply click the button. If you wanted to go to the Tbljournals table, click the Tbljournals tab to display the Tbljournals record and then the button will change to Change Tbljournals so you can then use this button to go to the Tbljournals table.

If you are unhappy with an edit that you have made you can click the Cancel button to exit from this record without saving your changes.

Once you have finished editing click the Save button to save your changes. You will then see the 'viewing' screen for the record that you have just edited, i.e the screen that displays a view of the data as seen in the section on Viewing your data, and the edits that you made will be vsible. You should also note the Successfully updated message that appears in the left hand side of the screen (indicated by a red oval in the figure below):

If you wish to perfom further edits on this record use the Edit button to return to the editing screen.

To exit this record and return to the table view click the Done button.

Adding a record

(These steps follow on from the section on Navigating to the relevant table.)

Whilst you are browsing your data you can add new records. Use the Browse data drop down menu to navigate to the table that you wish to work on. In this example we are using the Tblauthors table. Once you are in the screen showing the table you will see that there is a button at the bottom of the screen labelled Create tblauthors, this is indicated by a red oval in the figure below:

Click the Create tblauthors button. You will be taken to a new screen where you can add the relevant details to add a new author to the Tblauthors table:

Once you have filled in the relevant details click the Save button to save the record and create a new author in the table. Note: you will need to create a unique Id for the new record, the simplest way to do this is to note the next available Id when you are browsing the Tblauthors tables. In our example, Ids 1-10 are already in use so we have assigned an Id of 11:

Once you have added the new record you should see a message saying Successfully created in the top left hand corner of the next screen (see figure below). This screen also gives you the opportunity to create an associated record in the tables to which this table is linked, in our example the Tblarticles table. So, if you want to add an article for the author that we have just created we click the Add tblarticles button found at the bottom of the screen:

This will take you through a procedure similar to the one to add the author. In this case you will see that the linked record in the Tblauthors table is displayed at the bottom of the editing screen allowing you to add data either to the Tblarticles table or to other tables:

Once again fill in the relevant details, not forgetting to add an unique Id for this new record and click the Save button to add a new article, written by the newly added author, to the Tblarticles table.

Deleting a record

To delete a record, you need to be within the editing screen for that record. So, within the table view simply click the Edit link for the record you wish to view. The Edit link is found in the Action column on the right hand side of the screen:

This will take you to the screen that shows you the full details for that particular record:

If you want to delete a record simply click the Delete button within the editing window. This will return you to the table view and you will see the message Successfully deleted on the left hand side:

Important note: Using the Delete button does not require any further confirmation, once you click the button the record will be deleted.

Filtering and searching your data within a table

We can use the page that displays the data in a table to perform searches on the data within that table. You can search on any of the columns in your table, with the exception of the id column which is automatically generated. In the search filter pane at the top of the screen you will see a field for each searchable column, and you can type the text that you wish to search for into any of those fields.

To search for the word war in the title of an article enter %war (note percentage sign at the start) into the Title field in the search filter pane at the top of the window:

Click the Search button to perform the search. The search results, ie the records that contain the word war in the title, are displayed in the lower pane:

You can use wildcards in your search that substitute one or more characters. The permitted wildcards are:

  • % (percentage sign) matches zero or more characters
  • _ (underscore) matches a single character

So, to search for records published in 1990s you would enter 199_ into the Year field in the search filter pane and click the Search button:

Looking again at the search filter pane, you will see that at the bottom of the pane there is an extra heading labelled Match with two radio buttons labelled All and Any. The All radio button is selected by default. These radio buttons allow you to specify whether you are interested in records that match all of the search criteria you specify or just any of those criteria. For example, you might only be interested in articles whose titles contain the word war and were published in the 1990s. In this case you would enter %war into the Title search field, 199_ into the Year search field and select the All radio button. Then click the Search button:

This returns one result:

However, if you select the Any radio button:

and re-run the search you would see many more results:

This is because the search is looking for articles with war in the title or those that were published in the 1990s, ie either of the two search criteria rather than both.

If you want to do more sophisticated searching, e.g. searching across multiple tables, then you will need to use the query builder, described in the next section.

Searching your data using the query builder

The query builder allows you to write SQL queries to query your data.  SQL (Structured Query Language) is a powerful programming language that allows you to access and modify data held in an SQL database.  In particular, SQL allows you to view and manipulate data across multiple tables in the database rather than being restricted to manipulating data one table at a time as is the case with the ORDS table browsing tools.

The query builder will only be of use to you if you are familiar with SQL syntax and can write queries from scratch.  If you are not an SQL expert, or you need to brush up on your syntax, there are many online SQL tutorials on the Web. There are plenty of SQL resources, including tutorials, at the w3schools.com website.

Warning: The query builder allows you to delete and modify your data very efficiently. We recommend that you only use this tool if you are comfortable and confident with SQL programming.

To use the query builder click the Query Builder link in the top navigation bar of the data interface:

You will see a large dialogue box labelled Database Query, this is where you can enter the SQL that you wish to use to query or modify your data.

We can replicate our earlier example of searching the Tblarticles table for all titles containing the word ‘war’ using the following SQL query:

SELECT Title FROM Tblarticles WHERE Title LIKE '%War%';

To perform this query simply enter this SQL into the dialogue box and click the Query button:

Note: SQL pattern matching operators such as LIKE are case sensitive. If you want to avoid case matching use the ILIKE operator, e.g.

SELECT Title FROM Tblarticles WHERE Title ILIKE '%war%';

You can search across multiple tables using what is known as an ‘SQL join’.  A join retrieves rows from two or more tables and a join condition is used in the WHERE clause of select, update, delete.

You can execute any valid SQL using the query builder so this is a very powerful tool that should be used with care.

What next?

You may want to have a look at the next HOW-TO in the series:

Editing the structure of a database

You may also be interested in the whole list of HOW-TOs:
  1. Registering and creating a new project
  2. Preparing your data for ORDS
  3. Importing an existing database
  4. Creating a new database from scratch
  5. Creating and managing copies of your ORDS database
  6. Editing, filtering, and searching data using the ORDS
  7. Editing the structure of a database
  8. Sharing data with colleagues
  9. Creating customized data views
  10. Publishing datasets online
  11. Exporting data from the ORDS
  12. Using non-standard character sets
You can also find out more about the ORDS service by visiting the ORDS home page http://xxxxx.xxx.oucs.ox.ac.uk . If you have specific queries, you can contact the ORDS help desk by emailing xxxxxxxxxxxx@xxxxx.oucs.ox.ac.uk .