Datatable to Datatable Relationships

Relationships associate Datatable with other Datatable. Create relationships to link Datatable with each other, so that when your users view records, they can also see related data. This tutorial will show you how to create a relationship between two Datatable in a buzz. We will create a lookup association which forms a hierachical relationship, one to many, or also known as a parent - child relationship.

Overview

We will create a buzz "Hierarchy" with two Datatable: "Locations" and "Stuff". The Locations Microapp is the parent and the Stuff microapp is the child.

More information on creating Datatable is available in Creating a Buzz. The association between a Location record and Stuff records is achieved using a crossapp field.

Hierarchy Tutorial

The first step is to create the buzz Hierachy using a blank buzz template. Publish it. Then insert an Application. Modify the Datatable properties and name it Locations. Change the Results, Who can View Rows: to enable viewers. Add the following fields:

  1. TEXT Field named Place Name

  2. LOCATION Field named Location

Next add another Application to the buzz and name it Stuff. Add the following fields:

  1. TEXT Field named Some Info

  2. CROSSAPP Field named Parent Location. Modify the settings for the field to use the Buzz: Hierarchy, Microapp: Locations and Field: Place Name.

Your Buzz should look something like this:

Now modify the Stuff properties Results. Change Sort Field 1 to be the CROSSAPP field Parent Location.

We are going to do the same thing in the Locations Datatable. Modify the Results properties so that Sort Field 1 is Place Name.

Now comes the magic… In the Advanced Properies in the Locations Datatable Add the Rule

When row is filtered, then target Datatable ID: Stuff, broadcast Field ID: Place Name,

We are now ready to test. Begin by addding two new Locations:

  1. Place Name: First , Location: 3 KAY CLOSE MONA VALE NSW 2103

  2. Place Name: Second , Location: ADDISON ROAD, INGLESIDE NSW 2101

Next add three new Stuffs:

  1. Some Info: There are some cool mountains, Parent Location: Second

  2. Some Info: There’s some cool surf, Parent Location: First

  3. Some Info: There’s some cool shops, Parent Location: First

The Hierarchy Buzz should now look like this:

Click on the filter button in one of the rows in the Locations Datatable. The data in the Stuff Datatable should be filtered according to Location.


Last updated