Class: LinkItem

SuperMap.LinkItem

The LinkItem class.

new SuperMap.LinkItem(options)

LinkItem.js, line 5

This class is used to associate a vector dataset with an external table. An external table is a DBMS table in another dataset (where there is no spatial geometry in a pure attribute dataset). Vector datasets and external tables can belong to different data sources, but the data source type currently only supports SQL Server and Oracle types. When using LinkItem, Spatial data and attribute data must satisfy the association condition, that is, there is an associated field between the primary spatial data set and the external attribute table. SuperMap.LinkItem Only left joins are supported. UDB, PostgreSQL, and DB2 data sources do not support SuperMap.LinkItem; in addition, two tables used to establish associations may not be under the same data source. Note:

  1. The constraint of using SuperMap.LinkItem is: spatial data and attribute data must have an associated condition, that is, there is an associated field between the main spatial data set and the external attribute table;
  2. When creating a thematic map using the external association table, the associated field must have the name of the table. For example, if the associated field is the SmID of the BaseMap_R dataset, it must be written as BaseMap_R.SMID.
Name Type Description
options Object

The parameters.

Name Type Description
datasourceConnectionInfo SuperMap.DatasourceConnectionInfo

The foreign datasource information.

foreignKeys Array.<string>

The foreign key of the main spatial dataset.

foreignTable string

The name of the related foreign attribute table.

linkFields Array.<string>

The fields which retain the foreign attribute table.

linkFilter string

The connected condition of the foreign attribute table.

name string

The name of the related information object.

primaryKeys Array.<string>

The primary key of the related foreign attribute table.

Example
The following uses SQL query to illustrate the use of linkitem:
 function queryBySQL() {
     // Set link foreign database information
     var dc = new SuperMap.DatasourceConnectionInfo({
         dataBase: "RelQuery",
         server: "192.168.168.39",
         user: "sa",
         password: "map",
         driver: "SQL Server",
         connect: true,
         OpenLinkTable: false,
         alias: "RelQuery",
         engineType: EngineType.SQLPLUS,
         readOnly: false,
         exclusive: false
     });
    // Set link information
     var linkItem = new SuperMap.LinkItem({
         datasourceConnectionInfo: dc,
         foreignKeys: ["name"],
         foreignTable: "Pop_2011",
         linkFields: ["SmID as Pid","pop"],
         name: "link",
         primatryKeys: ["name"],
     });
     // Set SQL parameters
     var queryParam, queryBySQLParams, queryBySQLService;
     queryParam = new SuperMap.FilterParameter({
         name: "Province@RelQuery",
         fields: ["SmID","name"],
         attributeFilter: "SmID<7",
         linkItems: [linkItem]
      }),
     queryBySQLParams = new SuperMap.QueryBySQLParameters({
          queryParams: [queryParam]
             }),
     queryBySQLService = new SuperMap.QueryBySQLService(url, {
         eventListeners: {
             "processCompleted": processCompleted,
             "processFailed": processFailed
             }
     });
     queryBySQLService.processAsync(queryBySQLParams);
 }
 function processCompleted(queryEventArgs) {//todo}
 function processFailed(e) {//todo}

Members

datasourceConnectionInfoSuperMap.DatasourceConnectionInfo

The foreign datasource information.

foreignKeysArray.<string>

The foreign key of the main spatial dataset.

foreignTablestring

The name of the related foreign attribute table.

linkFieldsArray.<string>

The fields which retain the foreign attribute table.If the field is not set or the fields set do not exist in the external property table, the property information of any external property table is not returned. If the external table field you want to retain has the same name as the main table field, you also need to specify a field alias that does not exist as an external table.

linkFilterstring

The connected condition of the foreign attribute table.

namestring

The name of the related information object.

primaryKeysArray.<string>

The primary key of the related foreign attribute table.

Methods

destroy()

LinkItem.js, line 127

Disposes the resource. The property that references resource is set to null.