Stonefield Query Studio is essentially a front-end UI for a set of Stonefield Query project files. Although the structure of these files is documented, you should normally use Studio rather than modifying these files directly, as it's possible to render a project unusable by improperly changing the values of certain fields in certain records.

However, sometimes you may want to make bulk changes to the records in the data dictionary table. For example, perhaps you want to change "Company" to "Organization" where ever it appears in the caption of any field. It may be a lot of work to do this in Studio if there are a lot of fields that must be changed. For this type of operation, you can use the Stonefield Data Dictionary Query Utility. To bring up this utility, select the Query Data Dictionary function in the File menu. If SFQuery.INI for the selected project specifies more than one data dictionary file (see the Stonefield Query Project Files topic for details on how and why to do that), you are prompted to select the desired file to work with.

This utility shows the raw records in the REPMETA table that forms the Stonefield Query data dictionary for the selected project. The Stonefield Data Dictionary Query Utility has three sections:

  • The top section has a text box where you can enter a SQL statement to execute against REPMETA. The default is "select * from REPMETA," which displays all columns from all records. To display only fields, tables, or relations, choose the appropriate setting in the Display option; this essentially adds a hidden "where RECTYPE='F'," "where RECTYPE='C'," or "where RECTYPE='R'" condition to the SQL statement. Click the Execute SQL button to execute the SQL statement and display the results in the grid in the middle section. Click the Select All button to change the SQL statement to the default "select * from REPMETA" and display all records. Click the Help button to display the Data Dictionary Table Structure help topic for details on the structure of the table.

  • The middle section consists of a grid displaying the results of the SQL statement and a text box showing the content of the selected memo field. You can edit a value directly in the grid or text box; the change is saved automatically.

  • The bottom section shows the number of records retrieved by the SQL statement and the name and path of the open data dictionary table.

The SQL statement doesn't just have to be a SELECT statement. To make bulk changes to the data dictionary, you can use SQL UPDATE or DELETE statements. For example, to change "Company" to "Organization" where ever it appears in the caption of any field, use the following statement:

update REPMETA set CAPTION = strtran(CAPTION, 'Company', 'Organization') where CAPTION like '%Company%'

The status display at the bottom shows the number of records updated. To make sure you only update the correct records, you may want to first use a SQL statement that displays the desired records, such as:

select * from REPMETA where CAPTION like '%Company%'

We strongly recommend backing up the meta data files (REPMETA.*) before using the Query utility, as changes you make are permanent and can make a project useless if you change the wrong thing.