In event finders, the database consists of locations and events, where a given location may have many events. This is multi-dimensional relationship that requires creating an additional, related table in MetaLocator. In this tutorial, we will take you through the basics of setting this up.
First, we will import some locations using the typical import process covered in other tutorials on this Web site. We'll use this starter_import_locations sample file. This file contains a short list of locations.
We will also import events, but before we do that, we need to create another table. To create a new table, go to Data > Tables.
Click New in the upper right, and complete the form according to this screenshot:
Now we can import Events. We'll use this file: starter_import_events. Click on Import, and notice the new prompt to ask which table you are importing. Choose Data Table: Events, and complete the import process. You can ignore most warnings during the import about missing important columns like "Address", since we'll be deriving those from your locations.
Once successfully imported, your events can be viewed on the All Records screen. Notice the "Active Table" control now allows you to choose which data you are viewing:
Now that we have our events and our locations imported, we need to establish which events are at which locations. This can be done in two ways. First, you can manually edit each record and designate which events should be at which location. To do this, you need to add a field to your "Locations" table, that will allow you to connect the events to each location. To do this, go to Fields, then click "New" in the upper right. Let's call the field "Events at this Location", and choose Related Table Link as the field type and Events as the Related Table as shown here.
Now, when you edit a location, you will be able to browse Events, and associate them with that location.
Under Custom Fields, you will see a control similar to this one:
Attach Events to this location by clicking "Add Events"
As an alternative to manually associating events with locations, you can import a linking table. The linking table would contain only two columns, one to unique identify the event, and the other to identify the location associated with that event. Each column must be an External Key field, one from each table. The sample files in this tutorial each already have an External Key column.
The External Key field must be unique to it's row. No values can be repeated, or an error will be displayed. This External Key value serves to uniquely identify the row of the table you are importing.
When you import data in MetaLocator it doesn't necessarily know that the "EventKey" should be created as an External Key field type, so let's quickly edit the LocationKey and EventKey fields under Fields, and change their type to External Key.
Now we can import a linking table spreadsheet that contains only two columns, LocationKey and EventKey. It looks like this:
This starter_import_locations_events_link file basically states that location 1 is the venue for events "rock1" and "mime1" and so on.
We can import that file, and associate events with locations in bulk.
BUG: If, while importing the linking file, the data does not appear, reverse the column order in your linking file and retry the upload.
To add a drop-down list of Events to the Location search form, add this option to your Form Settings:
The mltable attribute instructs the system to pull the drop-down list contents from the events table.