Configuring parameters for a Query schematic attribute
An attribute Query is an attribute whose values will be returned by a query. Configuring Query schematic attribute parameters consists of specifying that query.
Query attributes can be configured on schematic feature classes or diagram templates. If the Query attribute applies to a schematic feature class, and the field you want to specify is returned by the custom query configured on that schematic feature class—or if this field comes from the schematic feature class itself—you don't need to create Query attributes; configuring a Field attribute is the solution in that case. It's exactly the same for a Query attribute that applies to a schematic diagram template; Query attribute definition has a meaning only if the queried field is not returned by the query configured on the schematic diagram template nor a field in the schematic diagram class itself. The steps below explain how to configure the query expected for this type of attribute.
To create the schematic attribute itself, you must start with the steps detailed in the Creating attributes on a schematic feature class or Creating attributes on a schematic diagram template topics and select Query when specifying the attribute Type at step 6. The steps below concern the specific Query attribute configurations that are expected to be operated at step 7 in those topics.
When selecting Query as the Type for a new schematic attribute, the Properties tab displays as follows:
You then have to configure the queried field whose values will define the attribute values:
-
Check the Use Associated Feature Data Source box if you are working with versioned data and you need to query another table based on the same version as each feature.
This will use the version that the related feature came from to run the query. In previous versions, you did not have this option; the query always ran against the default version.
Nota:If you are querying something in a different database, then do not check this box, as it will ignore the configuration and try to run the query using the same data source as the associated feature and won't be able to find the table you are trying to query.
- Click OK.
-
Click the Edit Query/Identifier button.
The Query/Identifier Editor opens:
- From the Data Source drop-down list, click the desired data source.
-
From the Tables list, click the table on which the query is going to operate.
The selected table's content automatically displays in the area at the right:
-
In the Query section, type your query SQL code.
As an attribute query must return a single value for each schematic feature or diagram related to the schematic feature class or diagram template on which the attribute query is defined, the query often requires parameters. The Parameters area is automatically displayed when you press the ? keyboard key for a parameter. As often as you reference a new parameter in your SQL query, a new entry corresponding to the new item is created in the Name column in this area.
- Use the Name drop-down list displayed in the Parameters section to choose the attributes that already exist on the schematic feature class or on its diagram template and that you want to be used as query parameters. Nota:
For a query attribute specified for a diagram template, only the name of the attributes that already exist for that diagram template display in this list. For a schematic feature class, the list contains all the attributes defined for the schematic feature class itself and those defined for its diagram template.
- Use the Is Text box to specify the type of the parameter value (checked when the parameter returns textual values, unchecked for any other type of values).
- Use the Test Value field to specify a test value before clicking Show Results and test the query result.
- Use the Name drop-down list displayed in the Parameters section to choose the attributes that already exist on the schematic feature class or on its diagram template and that you want to be used as query parameters.
- Click Show Results to check the records returned by the query.
-
From the Identifier drop-down list, click the field that will return the attribute values.
- Click OK to validate and stop the query attribute definition.
The SQL code is automatically reported in the Query area field from which the Query/Identifier Editor has been opened.
To put an end point to the Query schematic attribute creation, you then need to specify the parameters available in the Storage Mode and Evaluation Mode sections as explained in steps 8 through 11 in the Creating attributes on a schematic feature class or Creating attributes on a schematic diagram template topics.