Calling Procedure Set Methods

A Procedure Set method is executed by using a Set statement. The general syntax of the Set statement is:

Set {method-name} [of {object-ID}] {param1 … paramN} To {value1 … valueN}


The order of the parameters must match the list of parameters in the method's declaration, this is explained in further detail below. The parameters you pass can be either constants, variables or expressions, so long as they are of comparable type to the matching parameters in the method declaration.

If you are calling a Procedure Set method of the current object (current instance of the class) then you can use the Self keyword as the object-id. Refer to The Self Keyword section for more details. Alternatively, you can omit the object-id clause completely and DataFlex will automatically reference the current object.

Whether you place your parameters as {param1 … paramN} or {value1 … valueN} is really a matter on convention and will differ depending on the specific Procedure Set method you are executing. However, you must pass at least one parameter as value1.

Simple Procedure Set

Procedure Set methods are used primarily to simulate setting a Property. These are called simple procedure set methods. The syntax for calling simple procedure set methods is:

Set {method-name} [of {object-ID}] To {value}

This is exactly the same as the syntax for setting a property value. Here are some examples of calling a simple Procedure Set method.

// Call some Procedure Set methods of the "current" object

Set Label To "Customer Name:"   // set the label of the current object

Set Color To clBtnFace          // set the color of the current object


// Call some Procedure Set methods of an "external" object

Set Label of oAddrForm To "Customer Address:"

Set Color of oAddrForm To clGreen

In the above example, oAddrForm is an instance of the Form class. As the above examples show, executing a simple Procedure Set method is indistinguishable from setting a property.

Complex Procedure Set

Some Procedure Set methods are used to set two or more values at once. These are called complex procedure set methods. The general syntax for executing a complex procedure set is:

Set {method-name} [of {object-ID}] To {value1 … valueN}

Here are some examples of calling complex Procedure Set methods.

Set Location To 10 10     // set location of the current object to 10,10

Set Size     To iHeight iWidth


// now execute procedure sets of an "external" object

Set Location of oAddrForm  To 10 10

Set Size     of oAddrForm  To iHeight iWidth

In the above example, oAddrForm is an instance of the Form class.


Complex Procedure Set methods are being phased out of DataFlex in preference for multiple simple procedure set methods or properties.

Procedure Set With Special Parameters

Some Procedure Set methods require special parameters to be passed. The parameters are usually designed to identify which property the method will set from a list, or array, of similar properties. Common syntax for executing a procedure set with parameters is:

Set {method-name} [of {object-ID}] {item-id} To {value}


The DataDictionary class contains a set of properties that require calling procedure set methods with special parameters. The general syntax for calling these procedure set methods is:

Set {method-name}  [of {object-ID}]  Field      {file.field-id}  To {value}

Set {method-name}  [of {object-ID}]  File_Field {file.field-id}  To {value}


Here are some examples of calling Procedure Set methods with special parameters:

For iCount From 0 To 9

    Set Array_Value iCount To 0


In this example, the Array_Value method is being called to set the indexed property to 0 for the first 10 items. Some more examples are:

// set some properties of the current object

Set Field_Current_Value Field Customer.Name  To "Fred"

Set Field_Mask          Field Customer.Phone To "(###)########"


// set some properties of an 'external' data dictionary

Set Field_Default_Value of oOrderDD Field Order.Date         To dToday

Set Field_Mask          of oOrderDD Field Order.ContactPhone To "(###)########"

Refer to the DataDictionary class in the Class Reference for more information about Field and File_Field properties.

Some Procedure Set methods that require special parameters are also written the following way:

Set {method-name} [of {object-ID}] Item {item-id} To {value}

The Item keyword is can be used to designate that the first parameter {item-id} is an item or indexed value. The inclusion or exclusion of the Item keyword has no effect on your program. The use of this keyword is being phased out of DataFlex.