- Introduction to WorkXpress
- Building Your Application
- Examples and Best Practices
- Technical Manual
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 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.
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.
“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.
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.
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:
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.
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.
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.
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.
WorkXpress Relationships are able to function in either a one-to-one or one-to-many role without additional configuration.
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;
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.
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 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:
Relationship Types are inherently associated with the Item Types they connect.