ThScmTable
Represents the structure of a data table schema, including its name, caption, and the list of defined fields.This class is responsible for managing field definitions, enforcing layout rules, and supporting translation or metadata for UI rendering.
Used as the top-level schema container when designing or interpreting structured datasets in memory.
FindField
Finds a field by its internal field name. The match is case-insensitive and based on the logical identifier used in code or storage.function FindField(CONST TField: String): ThScmField;
Parameters
- TField: String; The internal name of the field to locate.
Return Value
Returns the matchingThScmField
if found.If not found, the returned field may be uninitialized or default.
FindField_By_VisualName
Searches for a field based on its visible (translated) name. This overload uses the given language to perform a localized search.function FindField_By_VisualName(CONST TField: String; CONST AtLang: ThTranslation_Language): ThScmField;
Parameters
- TField: String; The visual (caption) name of the field.
- AtLang: ThTranslation_Language; The language in which to search for the caption.
Return Value
Returns the field whose caption matches the given name in the specified language.FindField_By_VisualName
Searches for a field by its caption using default or current language.This overload does not require a language parameter.
function FindField_By_VisualName(CONST TField: String): ThScmField;
Parameters
- TField: String; The visual name (caption) to match.
Return Value
Returns theThScmField
that has a matching visual name in the current language context.FindField_By_Customized_Name
Finds a field by any customized or alternative name that may have been assigned during translation or dynamic schema generation.function FindField_By_Customized_Name(CONST AnyLang_Field_Title: String): ThScmField;
Parameters
- AnyLang_Field_Title: String; A field caption in any language.
Return Value
Returns the field whose display name matches the provided custom name.FindField_By_Prev_Field_Name
Searches for a field using a legacy or previously used field name.This supports backward compatibility with older schema versions.
function FindField_By_Prev_Field_Name(CONST TField: String): ThScmField;
Parameters
- TField: String; A legacy field name previously used in this schema.
Return Value
Returns theThScmField
that previously used the specified name.FindField_By_Json
Locates a field by its JSON-compatible name. Used during deserialization or when importing schema definitions from external sources.function FindField_By_Json(CONST FindJsonName: RawByteString): ThScmField;
Parameters
- FindJsonName: RawByteString; The JSON-formatted field name to match.
Return Value
Returns theThScmField
that corresponds to the given JSON name.Single_Record_Size_In_Bytes
Calculates the total byte size of a single record in the schema.This includes all fields according to their storage type and layout.
function Single_Record_Size_In_Bytes: Cardinal;
Return Value
Returns the total size in bytes of one record based on the field definitions.Key_Upto_Fields_Array
Returns an array of field names that define the key structure up to a specific point.Typically used to identify key fields or grouping fields within the schema.
function Key_Upto_Fields_Array: ThFlds_Name_Array;
ThFlds_Name_Array = Array OF String;
Return Value
Returns an array ofString
values representing the key field names.Test_IF_Prev_Field_Names_IS_IN_Collision_With_Field_Names
Checks for name conflicts between previous (legacy) field names and current field names.This test helps detect naming collisions when updating schemas or merging definitions.
function Test_IF_Prev_Field_Names_IS_IN_Collision_With_Field_Names(PopupMsg: Boolean): Boolean;
Parameters
- PopupMsg: Boolean; If
True
, a user-visible popup message is shown on collision detection.
Return Value
ReturnsTrue
if a collision is detected.Returns
False
if all previous field names are unique relative to current names.Test_Empty_Record_From_Field_Index
Returns the index of the first field in the schema that is not empty in a typical record.This is used for optimization or validation checks when evaluating whether a record is empty.
function Test_Empty_Record_From_Field_Index: Byte;
Return Value
Returns aByte
value indicating the index of the first significant field.Name
Specifies the internal name of the schema table.This value identifies the schema in code and exported formats.
property Name: String;
Sorting_Level
Defines the sorting priority level for the table in operations involving grouped or ordered schema tables.property Sorting_Level: Byte;
Protection
Specifies the access protection level applied to the table.Used to control visibility, editability, or export rules depending on schema policy.
property Protection: ThTableProtection;
ThTableProtection
Defines access control and editing rules for a schema table.This type determines how the table behaves in terms of user modifications and automated logic enforcement.
Type | Description |
---|---|
he_Edit_And_Rules | Both user editing and rule-based processing are allowed. |
he_Edit_Only | User editing is allowed, but rule-based logic is disabled. |
he_Rules_Only | Only rule-based logic is active; user editing is not permitted. |
he_Protected | Fully protected table; no editing or automated changes are allowed. |
Translate_Fields
Indicates whether field captions and values should be translated based on the active language.This enables multilingual rendering of UI elements associated with this table.
property Translate_Fields: Boolean;
Fields
Provides access to the list of fields that define the schema of the table.This collection determines the structure of a record and is used for validation, UI, and serialization.
property Fields: ThScmFields;
Export_To_Schema
Indicates whether this table should be included when exporting schemas to external representations.property Export_To_Schema: Boolean;
Key_Upto_Field
Specifies how many fields from the beginning of the field list are considered part of the key definition.Used to define uniqueness constraints or grouping behavior within the table.
property Key_Upto_Field: Byte;
Storage
Defines the physical or logical storage model used for this table.This setting determines how records are saved, indexed, or partitioned.
property Storage: ThTableStorage;
ThTableStorage
Defines the storage strategy used for a schema table.This determines how records are physically organized, especially in file-based or segmented storage systems.
Type | Description |
---|---|
he_Integer_Key_Optimized | Uses integer-based key indexing optimized for performance and compact storage. |
he_OneFile | All records are stored in a single file or container. |
he_FilePerPrimaryKey | Each primary key value is stored in a separate file, useful for isolated partitions. |
Storage_By_Field
Specifies the index of the field used to determine storage segmentation.Typically used to split data across storage containers or partitions based on field values.
property Storage_By_Field: Word;
Storage_Key_Range_Per_File
Defines the number of key values allocated to each file segment in partitioned storage mode.Used to manage file-based data distribution in large-scale datasets.
property Storage_Key_Range_Per_File: Cardinal;
Notes
Holds internal notes or documentation about the schema table. This property is informational only and is not used at runtime.property Notes: String;
StoreOnBigFile
Indicates whether the table should be stored within a large shared file structure. This option enables optimized bulk storage and reduced file fragmentation.property StoreOnBigFile: Boolean;
Secondary_Field_Must_Be_Unique
Enforces uniqueness on a secondary field in addition to the primary key. Used when certain columns must not contain duplicate values within the table scope.property Secondary_Field_Must_Be_Unique: Boolean;
ThScmFields
Manages a collection ofThScmField
records that define the structure of a data schema.This class provides access, manipulation, and lookup capabilities over the list of fields in a schema.
Used to define the full layout of records, including field order, naming, translation, and type metadata.
Acts as the primary container for field-level definitions within a
ThScmTable
.Add
Appends a new field definition to the schema field list.The returned instance can be configured with specific properties such as name, type, and visibility.
function Add: ThScmField;
Return Value
Returns aThScmField
record representing the newly added field.Items
Provides indexed access to individualThScmField
entries in the collection.Used to retrieve or update the properties of specific fields by their position.
property Items[Index: Integer]: ThScmField;
Parameters
- Index: Integer; The zero-based position of the field in the collection.
Return Value
Returns theThScmField
at the specified index.