Skip to content

Data Association Expression Rules Documentation

1. Concept of Association

Data association refers to the method of linking data items from two or more tables through specific conditions. This method can match and combine data from different tables during data querying or processing, facilitating more complex data analysis and applications. Associations are typically implemented through primary and foreign key relationships, where a primary key uniquely identifies a record in one table, and a foreign key in another table references the primary key, establishing a connection between the two tables.

2. Implemented Association Condition Types

The system has defined the following 8 types of association conditions:

TypeDescription
Date Part ComparisonDATE_FORMAT(${data_column_id}$, '%Y-%m') = DATE_FORMAT(${relation_data_column_id}$, '%Y-%m')
Null Handling ComparisonCOALESCE(${data_column_id}$, 0) = ${relation_data_column_id}$
Character ComparisonLEFT(${data_column_id}$, 3) = ${relation_data_column_id}$
Direct Value Comparison${data_column_id}$ = ${relation_data_column_id}$
Partial Character ComparisonLEFT(${data_column_id}$, 4) = LEFT(${relation_data_column_id}$, 4)
Case-Insensitive Partial Character ComparisonLOWER(${data_column_id}$) = LOWER(${relation_data_column_id}$)
Trimmed Character ComparisonTRIM(${data_column_id}$) = TRIM(${relation_data_column_id}$)

3. Description Method

When describing associations, follow these steps:

  1. Table and Data Item Splitting: Identify the associated tables and data items based on the data model.
  2. Clarification of Relationships: Clearly specify the relationships between tables and data items, including primary and foreign key relationships or other types of associations.
  3. Abstraction Description: Use abstraction to describe relationships to keep the logic of data relationships unaffected by changes in physical databases, enhancing the portability and scalability of the system.

4. Data Model Description Method

When describing data models, detail the model ID, model name, and description; table ID, table name, and description; and data item ID, name, and description.

Example: Data Model and Table Information

Data Model Table (ik_bp_data_model_basic)

Column NameData TypeNullablePrimary KeyAuto IncrementDefault ValueDescription
data_model_idintNoYesYesPrimary Key
data_model_codevarchar(255)YesNoNoData Model Code
data_model_namevarchar(255)YesNoNoData Model Name
data_model_remarkvarchar(255)YesNoNoData Model Description
is_delintYesNoNoDeletion Status

Data Table Information (ik_bp_data_table_basic)

Column NameData TypeNullablePrimary KeyAuto IncrementDefault ValueDescription
data_table_idintNoYesYesPrimary Key
data_model_idintYesNoNoData Model ID
data_table_codevarchar(255)YesNoNoData Table Code
data_table_namevarchar(255)YesNoNoData Table Name
data_table_remarkvarchar(255)YesNoNoData Table Description
is_delintYesNoNoDeletion Status

5. Association Expression

Association expressions are used to represent logical relationships between data tables and should be clearly defined and standardized.

6. Usage

Clearly define association fields, write association expressions, match and transform based on the primary table ID, and ensure the accuracy and reliability of data processing.

7. Data Entry Instructions

Define the association relationship, fill in the primary table data item ID and the associated table data item ID, and write a compliant association expression.

8. Example

Provide an example of an association condition type and corresponding association expression.