Class: JoinItem

SuperMap.JoinItem

The JoinItem class. This class is used to connect a vector dataset to an external table. The external table can be a DBMS table corresponding to another vector data set (where there is no spatial geometric information in the pure attribute data set), or it can be a user-built business table. It should be noted that the vector dataset and the external table must belong to the same data source. There are two ways to establish a connection between tables. One is a join and the other is a link. The connection actually appends an external table to the specified table based on the same field; the association is based on the same field that defines the association between the two tables, but not the actual append. The names of the fields used to join the two tables are not necessarily the same, but the types must be the same. When a connection is established between the two tables, the external table can be queried, the thematic map and the analysis can be made by operating the main table. When a two-to-one or many-to-one relationship between two tables is used, a join join can be used. When a many-to-one relationship is allowed, an association between multiple fields is allowed. (Note: SuperMap.JoinItem currently supports left and inner joins. Full and right joins are not supported. The UDB engine does not support inner joins. The two tables used to establish the join must be under the same data source.)

new SuperMap.JoinItem(options)

JoinItem.js, line 4
Name Type Description
options Object

The parameters.

Name Type Description
foreignTableName string

The name of the external table.

joinFilter string

The joint expression between the vector dataset and the foreign table, i.e., sets the related fields between the two tables.

joinType SuperMap.JoinType

The joint type between two tables.

Example
The following uses SQL query to explain the use of joinItem:
(start code)
  function queryBySQL() {
      // Set the join information with exterior tables.
      var joinItem = new SuperMap.JoinItem({
          foreignTableName: "foreignTable",
          joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
          joinType: "LEFTJOIN"
      })
      var queryParam, queryBySQLParams, queryBySQLService;
      // Set parameters
      queryParam = new SuperMap.FilterParameter({
           name: "Countries@World",
           joinItems: [joinItem]
        }),
      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}
(end)

Members

foreignTableNamestring

The name of the external table. If the name of the external table is “table name@datasource”, only the table name should be assigned the value. For example, the external table Name@changchun, Name is the table name, Changchun is the datasource name, the value of the attribute is: Name.

joinFilterstring

The joint expression between the vector dataset and the external table, i.e., sets the related fields between the two tables. For example, connect the district field of the Building dataset to the region field of the pure Owner attribute dataset. The names of the two tables in the two datasets are Table_Building and Table_Owner, and the joint expression is Table_Building.district = Table_Owner.region. When more than one fields are connected, the expressions are joined with AND.

The join type between two tables, i.e., the JoinType type. The join type determines the returned records of join query between two tables.

Methods

destroy()

JoinItem.js, line 80

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

toServerJSONObject()

JoinItem.js, line 91

Turned to be JSON object。