Displaying related records

How to show related details for multiple, related tables

Michael Fatica avatar
Written by Michael Fatica
Updated over a week ago

Relational data can be useful when displaying a parent-child relationships in MetaLocator. For example:

  • Doctors at hospitals

  • Products at stores

  • Staff at locations

  • Agents at brokerages

In these examples, the doctors, products, staff and agents are example of related records. The hospitals, stores, locations and brokerages are all locations, where one location can have many related records. In database jargon this is typically called a many-to-many relationship.

In MetaLocator, you must have a Platinum or higher account to establish these relationships.

Setup for Relational Data

To get up and running with related records, the steps are to create a related table, import data, create a related field and then configure in your interface.

The first 3 steps are covered in this article. That article describes the process of importing Physicians, where a given physician may work at one or more hospitals.

In this example we will continue that example and explore how that data can be displayed. It begins with creating a field in the locations table that we can use to link physicians and locations. This is a special type of field called Related Table Link, created as shown below:

Notice we've selected physicians in the Related Table drop-down. Now we should be able to view and manage any related physician records on a per-location basis as shown below:

With the above established, now we can modify the Interface to display the related data.

Displaying Related Data

With data properly configured, the Interface can now be updated to display physicians at these locations.

In this document, we've created a simple locator based on the Rich Media Interface Template, though any template will do. In the Interface builder, the first step is to add the related field created above to the results as shown below:

By default, one empty row will appear for each related record:

To control the fields to display there, we must update the template:

We will display the {{name}} field, which in this context will display the related physician's name.

Click Save, and you'll see the related physician name appear as shown below:

Any location field can be included in the related display to further extend the display. E.g. {{phone}} and so forth. The template can also include HTML for links, formatting or conditional logic.

Did this answer your question?