Data dictionary properties and configuration settings can only take Stonefield Query so far. For some things, you need to code what Stonefield Query does. Some examples of where scripts are useful are:

There are three different types of scripts in Stonefield Query:

Stonefield Query supports three languages for scripting: Visual FoxPro, VBScript, and JavaScript. The latter two require that the Microsoft Script Control be installed, both on your system and on the user's system. This is the case with Windows 2000 or later and any Windows 9x version with Internet Explorer 4 or later installed.

The default language for a new script is the same used last time you created a script. When you choose a language for an event or data object script, the code is automatically filled in with a template or sample in the selected language. If you select a different language after editing the code, you are warned that the code will be removed and replaced with template code in the newly selected language.

Stonefield Query supports link actions. In the Link page of the Field Properties dialog, the user can select what action to take when they click the selected field in the Preview window. There are three built-in actions: Email, which launches their email program with an email address filled in; Web site, which navigates their browser to a specific URL; and Report, which runs the specified report. You can also define custom actions. For example, perhaps you want another application to display the record for the customer name the user clicks in the Preview window. In that case, you have to tell Stonefield Query how to perform that action. That's where link action scripts come in. If you turn on the Link action setting for a script, Stonefield Query automatically includes the description contained in the Description setting in an Action drop-down list in the Link page of the Field Properties dialog. So, to continue this example, create a script that calls another application and tells it to display the record for the current customer name. Turn on the Link action setting for this script and set its Description setting to something like "Display customer information." The user can then select the customer name field in a report, select Action as the link type, and choose "Display customer information" from the Action drop-down. When they run the report, clicking the customer name calls your script, which does the necessary tasks to display the selected customer's record.

Note that the code for a link action script must accept two parameters. The first is a field name and the second is the value of that field in the record the user clicked. Your code can do anything it wishes with these parameters, except if the first parameter is blank, this is a "discovery" call from the Field Properties dialog. In that case, the script must return a comma-delimited list of field name that should appear in the Action Parameter drop-down list in that dialog. Here's an example of such a script:

lparameters tcFieldName, tuValue
if empty(tcFieldName)
  return 'Customers.CompanyName'
else
* do whatever is necessary
endif

If you find it difficult editing the code in the edit box, right-click and choose Zoom from the shortcut menu. This displays a larger editing window, which you can resize and set the font to anything desired. Also, IntelliSense is available, which provides quick access to properties and methods of Stonefield Query objects and syntax for built-in functions.

You can test the syntax of your code by clicking the Test Syntax button. Note this doesn't test for logical errors or actually run the code -- it only tests that it compiles correctly. If a syntax error exists, information the compiler returned about the error is displayed (how ever useful that may be).

You can insert a field name or expression into the code by clicking the Expression button to invoke the Expression Builder.