SchemaRelationship Object

The SchemaRelationship Object structure is used to hold relationship information. It can be accessed in any script, through the relationships property from the global schema variable. A relationship is used when setting up master/detail tables and when the server needs to determine the order to use for inserting/updating records.

The code snippet below shows how the relationships object can be used:

for (i=0; i<schema.relationships.count; i++)
{
  log('schema.relationships['+i+'].name:'+schema.relationships[i].name);
  log('schema.relationships['+i+'].masterDataTableName:'+schema.relationships[i].masterDataTableName);
  log('schema.relationships['+i+'].detailDataTableName:'+schema.relationships[i].detailDataTableName);
}

Properties

detailDataTableName

Represents the name for the detail table.

detailFields

Represents the names of the fields for the detail table, separated by a comma.

masterDataTableName

Represents the name of the master data table.

masterFields

Represents the names of the fields for the master table, separated by a comma.

relationshipType

Equals ForeignKey or MasterDetail.

description

Represents the description for this relationship.

name

Represents the name for this relationship.