Data Containers

Data Containers

Data containers allow for multiple tables to be used within a Form and are used within a one to many relationship or a one to one relationship. For example if you would like to track who the client is living with, but there is no way to determine how many people each client is living with, you can create a table to store the cohabitants and add as many as needed. There are primarily two methods to use when incorporating data containers within a Form.

One to One

  • One to one relationship – use this method if the main table has a large amount of fields within the table. This method is rarely used.
    • Place a data container on the form – this will default to the main table within the Form. Expand it so that it can encompass the secondary data container and any fields that need to display.
    • Place a secondary data container so that it’s wholly contained within the initial data container. Set the following properties. Once set it’s important to not expand the secondary container to be outside of the main container as doing so will remove any links that were set.
      • Select the table that the data will be stored in for the second data container.
      • Select the Link Field. This should be a field that is char(36) so it will link to the primary key of the main table.
      • Verify that the Master Link Field is the primary key of the main table.
Container Setup within a One to One Relationship.

One to Many relationship

  1. Data Container linked on Client. If the data container is linked on the Client then any data that is captured within the secondary container will “follow the client”. For example, if an Initial Assessment is completed and the client states who they are living with at the time of the Assessment then when a future Assessment is completed the cohabitants that were identified within the Initial Assessment will pull forward into future assessments.
    • When linking on the Client it is possible to place this data container on multiple Forms and any data collected will pull into all forms that use the table identified within the secondary container.
  2. Data Container linked on a foreign key from the child table with the primary key of the parent table. The foreign key in the child table should be the same name as the parent table. In this example the data that is entered in the child container would be specific to the Assessment that is being filled out and would not “follow the client”. An example of this would be drugs used in the last 30 days. The drugs used would be specific to the Assessment that is being filled out at the time the Assessment took place and it would not make sense to pull forward into future Assessments.
  3. Setup
    • Place a data container on the form – this will default to the main table within the Form. Expand it so that it can encompass the secondary data container and a grid as well as any fields that need to display.
    • Place a secondary data container inside the main container so that it’s wholly contained within the main data container. Once set it’s important to not expand the secondary container to be outside of the main container as doing so will remove any links that were set.
      • Select the table that the data will be stored in for the second data container.
      • Select the Link Field. This should be a field that is char(36) so it will link to the primary key of the main table.
      • Verify that the Master Link Field is the primary key of the main table.
    • Add a foreign key to the child table with a constraint that will cascade on delete.
Container Setup in a One to Many Relationship
One to Many with the Child FK as the Link + Link Properties

 

Image removed.

Changed
Tue, 02/11/2020 - 10:25