JOIN_TABLE

The JOIN_TABLE command joins the attributes from a table file to the features of a loaded vector layer. The following parameters are supported by the command:

  • LAYER_NAME - vector layer to join the attributes to.
  • FILENAME - file that contains the attributes to join to the vector layer features.
  • JOIN_FILE_ATTR_NAME - name of the file attribute to join on.
  • JOIN_LAYER_ATTR_NAME - name of the layer attribute to join on.
  • XLS_WORKSHEET - optional parameter to specify the name of the worksheet to use in a spreadsheet that contains multiple worksheets. Defaults to using the first worksheet if not specified.
  • FILE_DELIM - string that delimits the values in a text file. You can also use FILE_DELIM=SPACE for a space or FILE_DELIM=TAB for a tab delimiter.
  • CASE_SENSITIVE - specifies whether or not text comparisons are case sensitive or not. Use CASE_SENSITIVE=YES to enable, by default comparisons are not case sensitive.
  • IGNORE_WHITESPACE - specifies whether or not whitespace (i.e. spaces and tabs) should be ignored when looking for matches to join on. Use IGNORE_WHITESPACE=YES to ignore whitespace, by default whitespace is considered.
  • ATTR_TO_COPY - To only copy some attributes from the table, specify the attributes. Each attribute to be copied needs to be specified with a separate ATTR_TO_COPY command. It is valid to provide more than one instance of ATTR_TO_COPY. By default, all attributes will be copied (when this parameter is not specified).
  • ALLOW_DUPLICATES - specifies how duplicate entries in the join file should be handled. By default the last matching entry will be used, but you can set the behavior as follows:
    • KEEP_LAST (or YES) - keep the attribute values from the last matching record in the join file
    • KEEP_FIRST - keep the attribute values from the first matching record in the join file
    • KEEP_ALL_APPEND - keep all matching records from the join file, appending new values to the existing attribute with a comma separator
    • KEEP_ALL_APPEND_SORT_ASC - same as KEEP_ALL_APPEND, except that the list of values will be sorted in ascending order. If all of the values are numbers, they will be sorted using a numeric sort, otherwise, they will be sorted using a text sort.
    • KEEP_ALL_APPEND_SORT_DESC - same as KEEP_ALL_APPEND, except that the list of values will be sorted in descending order. If all of the values are numbers, they will be sorted using a numeric sort, otherwise, they will be sorted using a text sort.
    • KEEP_ALL_COPY - keep all matching reords from the join file, but create new attribute values with a numeric suffix for the multiple entries. For example if there were 5 matching records with an ADDR attribute, you would get ADDR, ADDR2, ADDR3, ADDR4, and ADDR5 attributes added
    • COPY_FEATURE - create duplicate features for each record with a duplicate join attribute, one addition feature for each duplicate join attribute value
    • PROMPT - prompt the user for how to handle duplicates if encountered
    • NO - abort the join if any duplicate records are encountered in the join file