Previous Topic

Next Topic

Book Contents

_CalculateDateTime

Calculates a new date and time by adding an interval to or subtracting an interval from another date and time. The interval is based on a date part, for example, a number of days.

Syntax

_CalculateDateTime(date,interval,datePart)

Parameters

Parameters for _CalculateDateTime

Parameter

Definition

Data type

date

Original date and time.

PFDateTime

interval

Time interval to add to or subtract from the original date time.

Integer

datePart

Date part to which the value specified in the interval parameter is added.

Integer

Returns

New date time (PFDateTime).

Notes

Example

This example sets a date for follow-up that is four weeks after the initial date entered. Both items are on the same form, so the rule is created at the form level. There is no enumeration for weeks in DateTimeParts, so the rule uses twenty-eight days instead of four weeks.

Note: Oracle recommends that you include rule logic to clear the calculated value if a referenced item value is cleared. For example, if a rule calculates BMI based on the values entered in the Height and Weight items, the rule should clear the BMI value if the data in the Height item is deleted. For an example of the appropriate rule logic, see Sample data-entry rules that use methods.

evaluate on Form Submission

value = _CalculateDateTime(this.InitialExamDate.Value, 28, DateTimeParts.Days)

always

set this.FollowupExamDate.Value = value

Send Feedback