Project 2000. Custom Fields and Grouping, страница 11

As shown above, each function name is displayed along with its related arguments. Selecting a function from the Function menu collapses the menu and enters the function name and the placeholder arguments into the formula at the current insertion point. The user can then double-click on the placeholder and replace it by selecting either a field name from the Field menu, another function from the Function menu, or by just typing in a value.


The special Project 2000 functions available are shown with their arguments in the following image and are further described below:

Figure 26 - Microsoft Project 2000 Functions Available

ProjDateAdd: Adds a duration to a date and returns a new date based on a calendar.

ProjDateConv: Converts a value to a date.

ProjDateDiff: Calculates the difference between two dates based on a calendar.

ProjDateSub: Returns the date that precedes another date by a specified duration based on a calendar.

ProjDateValue: Returns the date value of an expression.

ProjDurConv: Converts a numeric duration value in minutes (which the expression evaluator returns) to a display format duration with a value and label in the units specified (e.g., converts 480 to 8h)

ProjDurValue: Returns the number of minutes in a duration.

OK: When the user clicks OK in the Formula dialog, Microsoft Project verifies the formula syntax, checks for circular references, saves the formula, and then closes the dialog. Correct functioning and result of the formula is not verified, since there is potentially an unlimited interaction of functions, fields, and operators that would make verification overly burdensome.   For additional details on formula calculation and error checking, see “Formula Calculation and Error Checking,” later in this lesson.


Syntax checking: If the user has incorrectly typed in a field or function name, or has made some other detectable syntax error such as a missing bracket, the following message is displayed when the user clicks OK in the Formula dialog:

Figure 27 - Syntax error

When the user clicks OK, they are returned to the Formula dialog with the invalid item highlighted.

Circular references: If a formula causes a circular reference with other formulas (for example, if a formula being entered for Number1 depends on the value in Number2 and Number2 already depends on Number1), the following message is displayed:

Figure 28 - Circular reference

Pressing OK in the dialog returns the user to the Formula dialog with the invalid item highlighted.

If the user has left the formula blank, no message is generated when the user clicks OK; the user is returned to the Customize Fields dialog, with None selected for Custom attributes (instead of Formula).

Formula Calculation and Error Checking

The Microsoft Jet Expression Service (JES) is used as the expression evaluator for custom field formulas. This section contains miscellaneous information on how Microsoft Project custom field formulas work with the JES.

n  Formulas can be created that will result in errors, since it is impossible to check all the possible data types and compute what the type of the result would be, and there is no way of insuring that all possible results of a calculation will be within the range of permitted values. Therefore, if the result of the calculation for a given custom field is invalid, "#ERROR" will be displayed in the custom field.

n  Formula errors cascade to dependent fields, so whenever a calculation results in #ERROR, all other fields with formulas that reference that field will also show #ERROR.

n  Fields in formulas are replaced with values that are in Visual Basic data format, rather than the Microsoft Project 2000 internal data format. For example, duration and work values are in minutes rather than tenths of minutes, and dates are in vbDate format (a 64-bit (8-byte) number, where the value to the left of the decimal represents a date, and the value to the right of the decimal represents a time).