The fields that make up a table are shown under the "Fields" node in the TreeView for the table. Real fields (those that exist in the database) are shown in the TreeView as . Calculated fields have as the image. Fields can be displayed in alphabetical order or in their physical order in the table; the Sort Fields Alphabetically function in the Edit menu, the shortcut menu, and the toolbar toggles between these two sorts.

When you select a field in Stonefield Query Studio, the properties pane displays the properties for that field. There are four pages of properties. Click the buttons at the top of the properties pane to select the desired page.

Main Page

The Main page contains the main properties for a field. The following properties appear on this page:

Calc Page

The Calc page is used for calculated fields or those where the data displayed to the user is different from how it's stored. For example, most order entry systems don't store the extended price of an item, but derive it from the unit price multiplied by the quantity. However, you may want your users to be able to report on extended price, so you would create a calculated field for it.

All of the properties on this page are disabled if you've chosen any of the options on the Special page (discussed below).

The following properties appear on the Calc page:

Special Page

The Special page is used for three things: enumerated fields, displaying fields from related tables, and versioning. The first two items are disabled for calculated fields or those that you've specified an Output Expression for.

Version

The version setting contains the field's version number. A blank value means the field is not versioned: it appears in Stonefield Query regardless of the version of the database. For a field that isn't available in every version of the database, enter the version number followed by "+" to indicate the field appears in that version and higher versions and should not appear in lower versions (that is, the field was added in that version), "-" to indicate the field appears in that version and lower versions and should not appear in higher versions (that is, the field was removed in the next version), or no suffix to indicate the field appears only in that version and should not appear in any other version. For example, "5.3+" indicates the field is available starting in version 5.3 while "5.3-" indicates it was removed in version 5.4.

Use a comma-delimited list of values if the field was added in one version and later removed. For example, "5.3+,5.5-" means it was added in version 5.3 and removed in version 5.6.

Enumerated Fields

Enumerated fields are those that contain a pre-defined set of codes that mean something. For example, in the sample Northwind database that comes with SQL Server, the ShipVia field in the Orders table contains a 1, 2, or 3. These values aren't foreign keys looked up in another table, but rather hard-coded values, each of which represents a different shipping type. Often, these codes are displayed to the user in the application differently than they're stored. For example, the user might see "Fedex," "UPS," or "Mail" for the ShipVia field rather than 1, 2, or 3.

The Special page allows you to define the codes and display values for the selected field. To enable this feature, turn on the Enumerated Values option, then click Add (or press Alt+A) to add a new value to the list. In the Value column, specify the code value as stored in the field, and in the Description column, enter the value as the user sees it. Continuing with the above example, enter "1" for Value and "Fedex" for Description, "2" for Value and "UPS" for Description, and "3" for Value and "Mail" for Description. Use the Remove button (or press Alt+R) to remove the highlighted line.

See the Defining an Enumerated Field Programmatically topic for information on how to define an enumerated field at runtime.

Related Fields

For those fields that contain foreign keys, you likely don't want to display the foreign key values to the user since they probably don't see these values in your application and wouldn't understand the values stored in the field. Instead, you may want to display a particular field from the table that this field contains the foreign key for. For example, the Products table in the Northwind database has a CategoryID field that contains the foreign key to the Categories table. It might make sense to display the CategoryName field from the Categories table when the user selects the CategoryID field, since that's likely how they think of the category. Not only does this make it easier for the user to display the category name for a product (they can don't have to select the Categories table and then the CategoryName field), it also provides better performance, since Stonefield Query does an in-memory lookup rather than a two-table join.

To specify that a field from a related table is displayed in place of this field, choose the Special page, turn on the Display Field From Related Table option, select the desired table from the Table drop-down list (only tables that are parent tables in relationships to the current table are available; also, the relationships must be simple ones, as complex relationships aren't supported with this feature) and the desired field from the Field drop-down list.

Note that you can click "Table" or "Field" to jump to the selected table or field, respectively.

Comments Page

If you want comments about a field available to your user, such as a detailed description of the purpose or contents of a field, enter them on the Comment page. Any comments you enter are displayed in the Comments page of the Field Properties dialog in Stonefield Query.