Appboard/2.4/builder/associations: Difference between revisions
imported>Jason.nicholls |
imported>Jason.nicholls |
||
Line 14: | Line 14: | ||
To create an Association, edit the Data Source for which you want to create the Association. The Associate screen in the Data Source Wizard will allow you to select the field in each of the two Data Sources that you want to Associate. The following is an example of configuring an Association: | To create an Association, edit the Data Source for which you want to create the Association. The Associate screen in the Data Source Wizard will allow you to select the field in each of the two Data Sources that you want to Associate. The following is an example of configuring an Association: | ||
[[Image:appboard-2.4- | [[Image:appboard-2.4-associations.png|frame|Creating an Association Between Two Data Source entities]] | ||
In the above example, the | In the above example, each entry in the ''sparkline_services'' data source entity has a set (i.e. one-to-many) of corresponding entries in the ''sparkline_svc_history'' data source entity. The relationship is made by matching the ''Service'' field in both entities. This association is called ''history'' and will appear as an additional field to the ''sparkline_services'' entity, as shown below when previewing a data collection based on this entity: | ||
[[Image:appboard-2.4-associations-preview.png|frame|Previewing data collection with association]] | |||
==Using an Association as a Data Source== | ==Using an Association as a Data Source== |
Revision as of 16:39, 18 September 2013
Associations are a method of linking AppBoard Data Source entities to one another. The concept is similar to foreign keys in database tables where the key links rows within one table to one or more rows in another table, or even the same table.
An advantage of AppBoard providing this mechanism is allowing for associations between different data sources, so for example, rows within a database query with static information in a CSV file.
Associations can represent a one-to-one mapping or a one-to-many mapping. In cases of one-to-one mappings the fields from the associated data source entity are available for use alongside the fields from the main data source entity.
One-to-many mappings are useful to represent relationships and certain widgets rely on these being configured in order to visualize the data correctly. In particular the Tree Map widget, the Topology widget, and when using Sparkline column renderers with the Table widget.
Creating an Association
To create an Association, edit the Data Source for which you want to create the Association. The Associate screen in the Data Source Wizard will allow you to select the field in each of the two Data Sources that you want to Associate. The following is an example of configuring an Association:
In the above example, each entry in the sparkline_services data source entity has a set (i.e. one-to-many) of corresponding entries in the sparkline_svc_history data source entity. The relationship is made by matching the Service field in both entities. This association is called history and will appear as an additional field to the sparkline_services entity, as shown below when previewing a data collection based on this entity:
Using an Association as a Data Source
After an association is created, there is a new Data Source available, as shown in the following illustration:
Associations are indicated by the -> symbol in an AppBoard drop-down listing of Data Sources.
Selecting the "County Table -> USA_Counties" Data Source for a widget will automatically enforce the relationship established in the above Association. In this example, "County Table" is the name of the Board that contains the widget, and "USA_Counties" is the name of the field that was created by the Association in the example illustrated above.
Using Associations to Filter Data
In the article Filtering Collections Concepts, it was illustrated how an action in a Widget can invoke a client-side filter being applied to a Data Collection, which then presented filtered data in a different Widget on a Child Board.
The following example uses a different approach to achieve the same result:
Two things are observed in the above example:
- A special filter did not need to be applied to the "Zip Codes" Data Collection when the action was invoked on the "States Map" widget. The data is filtered automatically by the Association that exists between the "States" and "Zip Codes" Data Sources.
- In this example, The action in the "States Map" Widget does not need to modify the Data Collection. It simply launches the "Zip Code" Widgets.
Summary
This article outlined a method for configuring an action to launch a Board with relevant data by pre-configuring a server-side Association among the Data Sources in the current Board and the Child Board. Another way to launch a Board with information associated to a selected item is by applying a client-side filter. For more information about this approach, see Action - Apply a Filter to a Data Collection.
A common concept in AppBoard is to click on an item in a Widget to request more detailed information about that specific item. In many cases, this will launch a Child Board with Widgets detailing data for the selected item, as described in this article above. This concept of digging deeper into the data is called a "Drill-down". For information about other Drill-down configuration options, see AppBoard Drill-Downs.