Relationships associate Microapps with other Microapps. Create relationships to link Microapps 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 Microapps 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.
We will create a buzz "Hierarchy" with two microapps: "Locations" and "Stuff". The Locations Microapp is the parent and the Stuff microapp is the child.
More information on creating microapps is available in Creating a Buzz. The association between a Location record and Stuff records is achieved using a crossapp field.
The first step is to create the buzz Hierachy using a blank buzz template. Publish it. Then insert an Application. Modify the microapp properties and name it Locations. Change the Results, Who can View Rows: to enable viewers. Add the following fields:
- TEXT Field named Place Name
- LOCATION Field named Location
Next add another Application to the buzz and name it Stuff. Add the following fields:
- TEXT Field named Some Info
- 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 Microapp. Modify the Results properties so that Sort Field 1 is Place Name.
Now comes the magic… In the Advanced Properies in the Locations Microapp Add the Rule
When row is filtered, then target MicroApp ID: Stuff, broadcast Field ID: Place Name,
We are now ready to test. Begin by addding two new Locations:
- Place Name: First , Location: 3 KAY CLOSE MONA VALE NSW 2103
- Place Name: Second , Location: ADDISON ROAD, INGLESIDE NSW 2101
Next add three new Stuffs:
- Some Info: There are some cool mountains, Parent Location: Second
- Some Info: There’s some cool surf, Parent Location: First
- 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 Microapp. The data in the Stuff Microapp should be filtered according to Location.