Example Custom Attr Level

This worksheet is an example of a complex field select that requires a single data value.

The CUSTOM_ATTR_LEVEL database table has columns called CUSTOM_ATTR_NAME and CUSTOM_TYPE_ID. The configuration data tied to the Type column is substituted for the ? and the select is executed to return the custom_type_id value. This in turn in used to populate the CUSTOM_TYPE_ID field. It is not required for the field returned by the select and the field being updated be the same names as in this example.

Attribute Name Type
custom_attr_name custom_type_id,(select custom_type_id from &schemaid.custom_attr_type where description = ?)

Two important requirements are needed to use a complex statement like this.

  • the Export Query SQL can not be a simple select all as in the previous example
  • a separate map worksheet is required

The Export Query SQL must resolve the Type field back into the description text. The query is

"select * from &schemaid.custom_attr_level left outer join &schemaid.custom_attr_type on custom_attr_type.custom_type_id = custom_attr_level.custom_type_id order by custom_attr_type.custom_type_id"

The map worksheet "Custom Attr Level Exp" is needed to specify the "description" field.

Attribute Name Type
custom_attr_name description

"select *" can be used in the Query SQL statement because there is no conflict with the column names in the two tables.