Smart Client Extension for AutoCAD
Query Text
Query Text commands enable you to display values from a database table near the corresponding asset symbol. For example, the following floor plan uses query text (in white) to list the name, employee standard, and phone number (from the Employees table) of each occupant of a room. The query text is displayed on its own layer, separate from the room asset text (in blue).
You can create and modify query text definitions -- templates that describe what and how to render the query text -- using the AFM_QUERYTEXT command. Query text definitions are saved in the afm_dwgpub
table.
You can use the AFM_QUERYTEXT command to control the following properties of query text:
- the fields that are displayed
- text justification
- layer on which the text is stored
- text height
- label placement relative to upper left corner of asset
- offset from default asset text placement
- line formatting as one line per field value, or single line for all values, separated with a delimiter
To define query text, enter "AFM_QUERYTEXT" at the command prompt. The system presents the following form for defining query text properties. For example, for the Occupancy query text pictured above, the system presents this form and values, which control the behavior of the query.
From this form, you can:
- apply predefined query text definitions to the current drawing
- edit existing query text definitions
- define new query text definitions
The following table details the options on the form:
Option | Explanation |
---|---|
Owner Table | From the list of all asset types in the current drawing, choose the asset table for which you will display query text. |
Other Table |
In the option beneath the field list, you can choose from a list of tables that are related to the Owner table a second table from which to display fields. The fields list can display fields from a maximum of two tables. Therefore, if this query already has fields that span two tables, then this list will only contain those two tables. |
Rule ID | The value identifies the record defining the query text rule in the afm_dwgpub table. This is the name the user selects to load this query. |
Title | Enter a descriptive title for the query. |
One line per field? |
Determines if each field value appears on its own line within the drawing. Select this check box, and the program displays each value on its own line. Clear the selection from this check box, and the program displays all values on one line and separates the values with the Field Delimiter, described below. |
Field Delimiter | The symbol that separates fields when One Line Per Field? is Off. The backslash (/) is the default value. |
Default Settings (apply to all query text fields) | |
Relative Location | You can choose to position the query text relative to the asset's lower left corner, lower right corner, middle, upper right corner, and so on. |
X/Y |
Use these options to specify the X and Y offsets of the first line of text from the asset symbol’s own insertion point. These options are measured in AutoCAD drawing units and are handy for preventing the query text from obscuring the asset symbol or the asset symbol’s asset text. X is he horizontal distance away from the default Relative Location position. Y is a vertical distance away from the default Relative Location position. |
Justification |
Determines how the text is aligned in the drawings. Choose Left (the text is aligned on the left margin), Right (the text is aligned on the right margin), or Center (the text is centered horizontally). |
Layer |
The layer on which the program should draw the text. The default layer is HL-TMP. You can use this option to save text to a specific layer; however, it is generally not recommended that you save drawing text because it requires disk space and can be easily regenerated. |
Text Height | Enter the text height to use for the label. |
Per-Line Settings (Click a field, and you can set properties for just this field.) | |
Field | Click on a field in the list, and the form displays it in this option so that you can set properties for it. |
Suffix / Prefix | You can set an optional prefix or suffix for this field. |
Text Height |
If you want the selected field to display in a height different than the rest of the query text fields, set the height here. |
Font properties: Bold, Italic, Color |
Use these options to display the query text field in bold, italic, a selected color, or a combination. |
To apply a for pre-existing query text definition to the current drawing
If you are not sure of the existing query text definitions, you can view a list of the definitions for the current owner table and then display this definition.
If you do know the name of an existing query text definition, simply type it at the command line.
- Type AFM_QUERYTEXT at the command line.
- In the resulting Query Text form, select an Owner Table.
- Select a Rule Id from the list of query text definitions for this table.
- Click OK on the form to apply the query text definition to the current drawing.
- Once you display query text, clear it from the drawing by selecting Archibus / Asset Graphic / Clear Highlights from the Ribbon.
To create a new query text definition and apply it to the current drawing
- Type AFM_QUERYTEXT at the command line.
- In the resulting Query Text form, select an Owner table from the list.
- Click the Add button and enter a rule name and a description for the new definition.
- In the right central part of the form, complete the Default Settings options (location, justification, and so on). These properties apply to all fields of query text.
- Add the fields from the owner table that you want to display as query text. Click the Add button beneath the field list. The system presents the Select Fields form, listing all fields in the owner table.
- In the Select Fields form, move fields from the Available Fields list to the Visible Fields list by dragging them.
- Set the display order for the query text fields by arranging them in the desired order in the Select Fields form. To do this, you drag and drop the fields within the Available Fields list.
- Click OK when satisfied with the list. The system closes the Select Fields form.
- In the Query Text form, the field list now lists all the fields that you selected.
- You may want to add fields from another table. For example, in the above Occupancy query, the query text displays fields from the owner table (Room Code) and from the Employees table. Click on the drop-down list of tables, located below the Fields list, to select a second table. As per step 5, click Add to access the Select Fields form so that you can select a set of fields to add to the query text.
- You can remove any field from the list by clicking it and selecting the Remove button.
- Optional: You may want to set properties for the individual fields. For example, you might want one query text field to display in bold. To set properties for individual fields, click on a field in the field list.
- In the Default Settings area of the form, the system replaces the Default Settings options with a set of per-line options. For example, the below image shows that the user has selected the Room Name field and can now set properties for just this field.
- Set the field properties as desired.
- To return the form to the Default Settings options, double-click beneath the field list.
- In the Default Settings area of the form, the system replaces the Default Settings options with a set of per-line options. For example, the below image shows that the user has selected the Room Name field and can now set properties for just this field.
- Click the Save button to save this definition to the
afm_dwgpub
table.
Note: If you would like to apply the current definition to the drawing without saving the definition to the afm_dwgpub
table, it is not required that you click the Save button.
To delete a query text definition
- Type AFM_QUERYTEXT at the command line.
- In the resulting Query Text form, select the Owner Table whose definition you want to delete.
- In the Rule Id list, select the definition you want to delete.
- Click Delete.
- The command removes this definition from the.
afm_dwgpub
table.
To create a new query text definition from an existing one
- Type AFM_QUERYTEXT at the command line.
- In the resulting Query Text form, select the Owner Table whose definition you want to use as the basis for the new definition.
- In the Rule Id list, select the definition you want to use as a basis for the new definition
- Click Edit.
- Enter a name for the new configuration and a new description. The form displays the new Rule ID and description.
- You can now work through the Query Text form and edit the existing properties to change them as desired.