Relationships

  The selected file /tmp/filejqQ3aZ could not be uploaded, because the destination sites/default/files/css/css_a91cd284035e73ba34d112bfed2f5a16.css is not properly configured.
  The selected file /tmp/file1KETDl could not be uploaded, because the destination sites/default/files/css/css_de1aa27776f1462d2b0d83a80ce4b92d.css is not properly configured.

Relationships

Relationships are the ways your Items are linked together. They are commonly thought of in a relational database as one:one, one:many or many:many, but in WorkXpress, they are all simply Relationships.

Overview

Relationships are the essential Building Block that enable complex linkages across diverse sets of data. Whereas a Relationship Type defines how two Item Types are connected, an actual Relationship connects two specifc Items.

Relationships are essential to enabling complex, interwoven content.

Relationships” refers to the conceptual Building Block; one of the 5 fundamental building blocks

Relationship Type” refers to a set of Relationships defined by the builder. An example is the “employee-employer” Relationship Type that links some “Contacts” to some “Accounts”

Relationship” refers to a specific instance of a Relationship Type, usually created by a user. An example, Tom Smith is an “employee” of Acme Company, and Acme Company is the “employer” of Tom Smith.

Creation

“Creating a Relationship Type” refers to the act of creating a category for grouping Relationships. Relationships themselves are typically created by the user during the normal course of using the application.

How To Create

Relationships are created in context during the normal course of building your application, for example, while constructing a data map in the Data Navigator, or while adding a Field Type - Item Picker to a Layout Type - Grid. Specifically, there are four contextual methods for creating Relationship Types:

Method 1: Using the Query Builder Tool

Method 2: From within the “Layout Type - List” Wizard

Method 3: From within the “Field Type - Item Picker” Wizard

Method 4: From within the Query Builder tool, specifically, when using the “Add Item Type” Wizard

Methods 1 through 3 above will launch the “Add Relationship Type” Wizard. Method 4 above will create a Relationship Type automatically.

Wizard Questions

The Add Relationship Type Wizard needs to know 4 things. However, it often already knows at least 2 of the answers, and doesn't prompt for these. The questions are:

  1. What Item Type is on the “left” side of the relationship
  2. What Item Type is on the “right” side of the relationship
  3. What is the label for the “left” side of the relationship
  4. What is the label for the “right” side of the relationship

As an example, lets assume that we want to create a new Relationship Type that connects Accounts to Contacts as employer-to-employee. Our answer to question 1 is “Account”, 2 is “Contact”, 3 is “employer”, and 4 is “employee”.

In many cases, however, there is already significant context for the Relationship Type, and as a result, the answers to questions 1 and 2 may already be assumed. For example, if you are adding a Layout Type - List to a page about an Account, the Wizard knows that at least one side of your Relationship is probably “Account”, and answers question 1 for you. It may present a very simple select box to let you choose the answer to question 2.

From the Query Builder the ansers to questions 1 and 2 are both known, and the Wizard asks you for the answers to questions 3 and 4. It always assumes that these answers are simply the name of the Item Type and pre-populates those responses.

In a rare case (How to Create: Method 4 above) the Wizard assumes all four answers.

NOTE: “left” side and “right” side are meaningless in WorkXpress, they are just a means of establishing an order for answering the four questions, and were required for choosing a direction to display the Relationship out of context. Within the application, however, the Relationship will always have context. This means the Relationship could display as “employer to employee” on an Account page, but as “employee to employer” on a Contact page. The original sides lose all importance when in context.

Automations

Creating a new Relationship Type typically does not involve any automation in and of itself. Depending on the context, other Blocks may create automations around the Relationship. For example, when creating a Field Type - Item Picker, the Item Picker Field itself will automate the creation of some Actions to properly manage the creation and deletion of Relationships of this type.

Usage

Relationships are used primarily within the Query Builder. They are most commonly a tool to define connections between Item Types, thereby allowing the identification of exactly the right Items for a given purpose.

Editing

To edit the settings of a Relationshp Type, you must use the Block Editor Tool. You can launch this Tool by finding the Relationship Type in the Reuse tab of the Block Creator Tool, and clicking on the edit wrench next to the Item Type you wish to edit.

One-to-One, One-to-Many

WorkXpress Relationships are able to function in either a one-to-one or one-to-many role without additional configuration.

Storing Data on Relationships ("Many-to-Many")

Relationships also have a unique usage. Like Item Types, they are a place with which a Field can be associated, and as a result, on which data can be stored. Storing data on Relationships from a technical standpoint is the equivalent of creating a “many-to-many” data table in a relational database; however, it does not require the intermediary tables commonly associated with that type of Relationship. Using a Relationship as a data storage location, rather then creating an intermediary Item Type, greatly simplifies the architecture of many common functions, such as attaching Products to an Invoice via a Line Item. In WorkXpress, you simply store Fields like “Quantity” and “Extended Price” on the Relationship itself!

There are two methods to create a Field that is associated with, or “about”, a Relationship;

  1. Using the Block Creator Tool, drag a Field Type onto a Layout whose context is about the Relationship Type. For example, you may have a Layout Type - List that is actually about a Relationship Type; dropping a new Field Type in that list will create a new Field about the Relationship Type. Data entered into that Field in the future will store the data on the specific Relationship it is about.
  2. Using the Block Editor Tool, editing the Relationship Type will provide a mechanism for adding new Fields about that Relationship Type (Q1 2010).

Multiple Relationships Between the Same Two Items?

You may enable multiple Relationships of the same type between the same two Items (note: this setting is disabled by default). This is necessary when two Items are in fact related multiple times, and where each instance of that Relationship includes a common Field with a value unique to each instance.

For example: Tom Smith (a Contact) worked for Acme Company (an Account) on multiple occasions. However, each time, his start date, title and salary were different. To model this behavior, the “employee to employer” Relationship Type would need to be created on 3 separate occassions, each with different values stored in the start date, title and salary fields.

Relationship to a Relationship?

Relationships that join another Block to a Relationship are currently possible in theory, but the interfaces to support this are planned functionality. Please post here if you need this capability sooner!

Referential Integrity and Recycling/Deleting a Relationship

Referential Integrity is required when you wish to enforce the existence of both sides of a Relationship at all times. Traditional concepts of referential integrity can easily be enforced with simple Actions, and in WorkXpress referential integrity represents more of a validation process using Actions than a strict data process.

However, WorkXpress does not allow a Relationship to exist with only one side. Recycling or deleting an item necessitates the recycling or deletion of any Relationships to it:

  • When an Item is recycled, its Relationships are also recycled. Restoring that item also restores its Relationships.
  • When an Item is deleted, its Relationships are also deleted. This deletion is permanent and cannot be undone.

Item Association

Relationship Types are inherently associated with the Item Types they connect.

Settings

There are two tabs of settings available when editing a Relationship Type:

start/add relationship type.txt · Last modified: 2016/09/14 18:19 (external edit)
Copyright WorkXpress, 2024