Skip to content

Key_Field_State - DataDictionary

Designates a table column as the primary key column for a table

Type: Property
Access: Read/Write
Data Type: Integer
Parameters: None

Parameters

Parameter Type Description
iField Integer Number of the column in the table

Syntax

Property Integer Key_Field_State
Access Type Syntax
Read Access: Get Key_Field_State to IntegerVariable
Write Access: Set Key_Field_State to IntegerVariable/Value

Description

Key_Field_State designates a column as the primary key column for the table. If your primary Key consists of multiple column segments, all columns in the key should be marked as Key columns.

Key columns are columns that have been designated to uniquely identify records in a table (e.g., customer_number in a customer table). The property used to designate key columns is Key_Field_State.

Sample

Set Protect_Key_State to True
Set Key_Field_State Field Customer.Id to True

After you have designated key columns, you may set options for them as a group using Foreign_Field_Options.

Set Key_Field_State Field Customer.Id to True

One use of setting this option can be to prevent changes to the data stored in the column. This is known as key-column protection. Key-column protection allows data to be entered into the key column only when the record is first created. Once the record is created, the key-column data cannot be changed.

You would normally set this option on primary key columns such as the Order Number column in an Order Header table or the Customer Id column in a Customer table. This offers prevention from "orphan" child records by preventing the Id columns used in parent-child relationships from being changed.

Key columns are only protected in a table if Protect_Key_State is set to True in the DataDictionary Object (DDO).

See Also

Protect_Key_State | AllowParentFind | IsCommitted | ParentNoSwitchIfCommitted | | Defining Data Dictionary Table Attributes