setfieldproperties
DATABASE
,
FIELD
,
DICTIONARY

The setfieldproperties statement modifies one or more properties (name, data type, formula, etc.) of the current field.


Parameters

This statement has three parameters:

database – name of the database containing the field to be modified. This parameter is optional, if omitted the current database will be assumed.

field – name (or number) of the field to be modified. This parameter is optional, if omitted the current field will be modified. Note: The data type and choice options cannot be changed for anything other than the current field in the current database.

dictionary – is the dictionary that contains one or more new properties for the field. This dictionary is usually created with the initializedictionary( function.


Description

This statement modifies one or more properties (name, data type, formula, etc.) of a field. Normally, the current field is modified. The properties are stored in a dictionary, making it easy to modify individual properties or a bunch of properties at once.

This example changes the name of the Company field to Organization.

field Company
setfieldproperties initializedictionary("NAME","Organization")

Alternatively, you can specify the field to be modified right in the setfieldproperties statement. This allows the properties to be changed without changing the current field.

setfieldproperties "Company",initializedictionary("NAME","Organization")

The next example changes the type of the Quantity field to floating point (numbers). The available data types are Text, Integer, Float, Date, Choices and Binary.

field Quantity
setfieldproperties initializedictionary("TYPE","Float")

Note: Unlike other properties, the TYPE property can only be changed for the current field. If you want to change the type of a field, you must first use the field statement to make it the current field.

There are over a dozen different field properties that can be modified, and more are being added with each new release of Panorama. To find out the current list of available properties, use the getfieldproperties( function.

listdictionarykeys(getfieldproperties())

Changing Field Properties in Another Database

You can even add a third parameter to this statement to specify a database other than the current database. As long as the database is open, you can change the properties of any field (except for the TYPE and CHOICES properties). This example changes the width of the Price field in the Price List database, even if the Price List window is not currently the topmost database.

setfieldproperties "Price List","Price",initializedictionary("WIDTH",12)

See Also


History

VersionStatusNotes
10.2UpdatedNow allows properties of any field in any open database to be modified, not just the current field in the current database.
10.0No ChangeCarried over from Panorama 6.0.