Setting the Logical Date
Current System Date
Most of the common date calculations performed by AskPlus use the current system date as the reference date. For instance, %DAYS-OLD(d1) returns the number of days between any specified date (d1) and the current system date. Many times, however, reports require date calculations based on a different date, ie the end of the previous month, or yesterday's date.
Setting a Logical Date
With AskPlus version E.8.2.1 and higher it is possible to set a global reference date (ASK_REFDATE) that will override the system date returned by $SECONDS, which is the AskPlus variable that returns the current date and time in internal format. When ASK_REFDATE is set, $SECONDS will return a value that corresponds to the specified date and the current time. Setting this reference date allows you to run a report and have it's date calculations behave as though it had been run on the specified logical date. (Keep in mind that the data will not necessarily be the same as it was on the reference date.)
- ASK_REFDATE effects the system variables $SECONDS, $TODAY, $YESTERDAY. All other date system variables are based on the actual date.
- ASK_REFDATE will only be used if it contains a valid date. If the value is zero, or some other invalid date, it will be ignored and the current date will be used.