Skip to content

Intalink Link Data Explanation

Table of Contents

Return Value Meanings

  • msg: Interface return message.
  • code: Status code.
  • data: Return value, list type, each element is a relationship link.
  • data[i]: Elements within data, list type, each is a link's connection (ordered by the link sequence).
  • before: Data table corresponding to the connection's start point.
  • after: Data table corresponding to the connection's endpoint.
  • MainTable: Data table corresponding to the MainColumn in the expression.
  • RelationTable: Data table corresponding to the RelationColumn in the expression.
  • Relation: Inter-table relationship expression. Each relationship is connected by a ?. "77-53" represents the data item IDs for MainColumn and RelationColumn. The string COALESCE(${MainColumn}$, 0) = ${RelationColumn}$ after "77-53" represents the join expression between these two fields.

Return Value Example

json
{
    "msg": "Operation successful",
    "code": 200,
    "data": [
        [
            {
                "before": null,
                "after": "Vehicle Sales Table"
            },
            {
                "before": "Vehicle Sales Table",
                "after": "Vehicle Information Table",
                "MainTable": "Vehicle Information Table",
                "RelationTable": "Vehicle Sales Table",
                "relation": "77-53:${MainColumn}$ = ${RelationColumn}$"
            }
        ]
    ]
}

Using the example from the interface return value, we identify the following link:

  • Vehicle Sales Table -- Vehicle Information Table

Data Table and Data Item Information Retrieval

The table and field information retrieved from the database is as follows:

Data Item IDData Item CodeData Item NameBelonging Table IDData Table CodeData Table Name
52ProductionDateProduction Date68CarVehicle Information Table
54CarIDVehicle ID69salesrecordVehicle Sales Table
77SalesRecordIDSales Record68CarVehicle Information Table
53RecordIDSales Record ID69salesrecordVehicle Sales Table
55SaleDateSale Date69salesrecordVehicle Sales Table
64UsageDateUsage Date72PartUsagePart Usage Situation
63PartIDPart ID72PartUsagePart Usage Situation
58PartIDPart ID71PartsVehicle Parts Table
50ManufacturerManufacturer68CarVehicle Information Table
76NewDateManufacture Date71PartsVehicle Parts Table
59PartNamePart Name71PartsVehicle Parts Table
72ColorColor68CarVehicle Information Table

SQL Generation

Initial SQL Writing

Given the parameters 52,54, based on the link, the tables involved are Vehicle Sales Table (salesrecord) and Vehicle Information Table (Car). The initial SQL could be:

sql
SELECT ProductionDate, CarID FROM salesrecord, Car

Adding Join Expression

Analyzing the expression 77-53:${MainColumn}$ = ${RelationColumn}$, simplify it to 77=53, and replace the corresponding data item IDs with data item codes, resulting in SalesRecordID = RecordID. Then, incorporate this condition into the WHERE clause to obtain the final SQL:

sql
SELECT ProductionDate, CarID FROM salesrecord, Car WHERE SalesRecordID = RecordID