FindDate function

The description of the FindDate function is:

  • Calling Parameters of (SearchString (text, length 3), Calendar (Date table), PeriodType (Option, integer))
  • Returns DateFound Boolean

The calling syntax for the FindDate function is:

BooleanVariable := FindDate(SearchString,CalendarRec,PeriodType)

This function is often used in pages to assist with the date calculation. The purpose of this function is to find a date in the virtual Date table based on the parameters passed. The search starts with an initial record in the Calendar table. If we pass in a record that has already been initialized by positioning the table at a date, that will be the base date, otherwise the Work Date will be used.

The PeriodType is an Option's field with the option value choices of day, week, month, quarter, year, and accounting period. For ease of coding, we could call the function with the integer equivalent (0, 1, 2, 3, 4, 5), or set up our own equivalent Option variable. In general, it's a much better practice to set up an Option variable because the Option strings make the code self-documenting.

The SearchString allows us to pass in a logical control string containing =, >, <, <=, >=, and so on. FindDate will find the first date starting with the initialized Calendar date that satisfies the SearchString logic instruction and fits the PeriodType defined. For example, if the PeriodType is day, and the date 01/25/16 is used along with the SearchString of >, then the date 01/26/16 will be returned in the Calendar.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.196.59