Like a virtual table, a calculated field doesn't physically exist but is defined only in the data dictionary. 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. Calculated fields are shown with this icon in the TreeView:

To create a new field in a particular table, click the Create button () when the "Fields" node or a specific field node in that table is selected in the TreeView; alternatively, you can click the drop-down arrow beside the Create button and choose Create Field from the menu, or choose Create Field from the Objects or shortcut menus.

Enter the various properties for the field in the Main page of the properties pane, and in the Calc pane, enter the formula used to calculate the value for the field in the Output Expression property.

If you're querying against a Visual FoxPro database and you create a calculated field using the ALLTRIM() function as the expression, such as ALLTRIM(MyField), Stonefield Query may find more records than expected when the user filters on that calculated field due to the way string comparisons are done. In that case, add "UseAnsi=Y" to the [Options] section of SFQuery.INI (this isn't the same as the "UseAnsi=Y" settings in Data.INI; see the Stonefield Query help file (SFQuery.chm) for information on that setting):

[Options]
UseAnsi=Y

See also

Creating a Virtual Table | Field Properties

© Stonefield Software Inc., 2023 • Updated: 06/03/16
Comment or report problem with topic