nextFreqDate Method

Class: Date

Description

This method returns the next date based on applying the specified frequency to the specified Date object. For example, if the specified date is January 4, 2005 and the frequency is 1MA1, the resulting date is February 1, 2005.

Syntax

dateObject.nextFreqDate(String frequency,Number AF,String control)

Parameters

frequency

A valid Profile frequency applied to determine the next date (e.g., 1MA1 for once a month on the first of the month).

AF

The annual factor (i.e., the number of frequencies in a year). For example, a frequency of 1MA1 will return 12. (Optional)

control

A 5-character (optional) code indicating the type of frequency calculation to perform. Each position in the code will have a value indicating whether to perform the operation (i.e., 0=No, 1=Yes):

 

Position

Operation

 

1

Use reverse (backwards) calculation.

 

2

Edit check for correct syntax only. Returns "1" if errors occur, "0" if no errors.

 

3

Use "A" business date option regardless of what is found in the frequency.

 

4

Interactive -- print next date on bottom of screen.

 

5

Automatically advance the date by at least one full cycle.

Returns

A Date object representing the next date based on the specified frequency and other parameters.

When Became Available

Profile v7.0

Example

type RecordDEP dep = Db.getRecord("DEP", "CID=:CID")

if dep.ipd = %SystemDate do {

do POST(.dep) // Post interest

set dep.ipld = %SystemDate // Save date last posted

 

// Get next posting date, and save

set dep.inp = dep.inp.nextFreqDate(dep.ipf)

do dep.save()

}

* Variable CID must be defined prior to the getRecord statement.