Names

In a script, you’ll refer to the names of objects such as fields, windows or forms in an application dictionary. Depending on the object referenced in the script, you must indicate either the object’s simple name or qualified name.

Simple names

A simple name is the name you give an object when you create it. When you use a simple name, sanScript assumes that the object is part of the current window where you’re attaching the script. This allows the same object to be used in multiple places.

For instance, in an application that stores customer records, the Customer Number field is used in several places. If a simple name is used to refer to the Customer Number field, Dexterity assumes you’re referring to the Customer Number field in the window where you’re attaching the script. The following script will disable the Customer Number field of the current window.

disable field 'Customer Number';

A simple name must start with a letter, and can contain up to 78 additional letters, digits, underscores or spaces for a total size of 79 characters. A simple name that has spaces in it must be surrounded by single quotation marks when referenced in a script.

Because names must be surrounded with single quotation marks if they contain spaces, we recommend that you substitute underscores for spaces in names when you name objects in your application. This makes them easier to use in scripts.


Examples of valid simple names are shown in the following table:

[spacer]

This name

Is valid because

CustomerMaster

There are no spaces in the name so no single quotation marks are needed.

Customer_Master

This name has an underscore instead of a space between the first and second words.

'Customer Master'

The name is enclosed in single quotation marks, so it may contain spaces.


The following names aren’t valid simple names:

[spacer]

This name

Isnt valid because

Customer Master

It contains a space, but isn’t surrounded by single quotation marks.

1CustomerMaster

The name starts with a digit.


Single and double quotation marks are used differently in scripts. Single quotation marks indicate the names of objects, while double quotation marks indicate the item between the quotation marks is a string value.


Qualified names

A qualified name explicitly specifies the location of the object being referenced. Qualified names consist of a qualifier, which specifies the location of the object, and a simple name. Qualified names are used to reference objects that aren’t part of the current window or to resolve name conflicts. For example, to refer to the Customer Name field in the Customer_Master table instead of the Customer Name field in the current window, you would qualify the field with the of table qualifier as shown in the following script.

'Customer Name' of table Customer_Master = "Bob Smith";

A qualified name can have one of three syntaxes:

field name of window window name

field name of window window name of form form name

field name of table table name

When you use qualified names containing spaces in the name, the “of” portion of the name shouldn’t be inside the single quotation marks. The following name is valid:

[spacer]

This name

Is valid because

'Customer Name' of table Customer_Master

The “of” portion of the name is not within the single quotation marks.


The following name isn’t a valid qualified name:

[spacer]

This name

Isnt valid because

'Customer Name of table Customer_Master'

The “of” portion of the name is within the single quotation marks.


Local fields have a special qualifier that indicates the field is a local field. When you reference a local field in a script, the letter L in parentheses – (L) – must be included before the name of the field, with the entire name enclosed in single quotes. For example, the following name for the Customer Type local field is valid:

[spacer]

This name

Is valid because

'(L) Customer Type'

The (L) portion of the name is enclosed within the single quotation marks.


However, the following name isn’t valid:

[spacer]

This name

Isnt valid because

(L) 'Customer Type'

The (L) portion of the name is not within the single quotation marks.



Documentation Feedback