Pivot Table

Feature Description

Create a pivot table for the dataset properties table, which can reduce record redundancy and simplify the one-to-many relationships in the records.

Special Notes:

  • This tool is only applicable to: UDB/UDBX, database datasource.
  • The combination of enter a field, pivot table field, and value field values must be unique; otherwise, the pivot table field value will be filled with the maximum value of the value field by default.
  • The number of fields in the pivot table is determined by the enter a field and each unique field value in the pivot table field. The number of rows in the pivot table is determined by the unique combination values of enter a field. If one row of enter a field values corresponds to multiple pivot table field values, the maximum value is taken as the pivot table field value.

As shown in the figure below, the result table is a pivot table of the source dataset properties table, used to better display the distribution of three land use types in two regions. "Enter a field" is DLBM and DLCM, with unique combination values {031, woodland}, {013, dryland}, {021, orchard}, so the pivot table contains three rows of records. "Pivot table field" is QY, and the two unique values of QY, "Longquanyi District" and "Wenjiang District", will be used as field names in the pivot table. The fields "Longquanyi District" and "Wenjiang District" will be filled with values from the DLMJ field.

Parameter description

Parameter Name parameter interpretation parameter type
Datasource Specifies the datasource where the pivot table dataset is to be created. Datasource
Dataset Specifies the source dataset for which the pivot table is to be created. DatasetVector
enter a field Specifies the fields from the source dataset to be included in the pivot table. These fields are typically business (non-system) fields that users wish to retain in the result. String[]
pivot table field Specifies a field from the source dataset as the "pivot table field". The unique values of this field will be used as fields in the output pivot table.
Special Notes:
1. For fields in the output pivot table, note the following situations:
  • If the field value is a number or starts with a number (e.g., 2024, 2024aa), the letter f is automatically prefixed to the field name (f2024, f2024aa);
  • If the field value contains special characters that cannot be used as a field (e.g., #2024aa, a?a), the special characters are automatically replaced with underscores (a_a). If the field name starts with an underscore after replacement, the letter f is automatically prefixed (f_2024aa);
  • If the field value contains Null values, the tool execution fails.
2. The number of unique values in the "pivot table field" must not exceed the maximum field limit of the database.
3. The "pivot table field" only supports types that can be compared in size, such as numeric, character, date, time, etc., and does not support binary, boolean, or geometry types in spatial databases.
String
Value Field Specifies a field from the source dataset as the value field. The values of this field will be used to fill the values of the pivot table field. String
target datasource Specifies the datasource for storing the result dataset. Datasource
the name of the resulting dataset Specifies the name of the resulting dataset. The created pivot table will generate a tabular dataset. String
Whether to overwrite an existing dataset (optional) If a dataset with the same name exists in the target datasource, whether to overwrite it. Checked means overwrite; unchecked means the execution fails if a dataset with the same name exists. Default is unchecked. boolean

Output Result

Parameter Name parameter interpretation parameter type
target dataset result vector dataset DatasetVector