#THIS
Syntax:
#THIS
This operator provides values in four different libraries:
In Date Adjustments, #THIS provides the date prior to adjusting and rounding.
In Service Rounding, #THIS provides the numeric value prior to rounding.
In salary and service transformation expressions, #THIS provides values at each date in #date.
Suppose that your Hours field is called HOURS, then in this Hours transformation expression:
R1:= HOURS &
R2:= #THIS &
R1 doesn't always equal R2 (see assignment using array fields)
Suppose that your Salary History is called based on the array field called SALARY, then in this Salary transformation expression:
P1:= SALARY &
P2:= #THIS &
P1 doesn't always equal P2 (see assignment using array fields)
Examples
1. Date adjustment expression:
Suppose the service computation, based on elapsed time, depends on the day of the month in which date of hire occurred. If hired before the 16th of the month service starts on the beginning of the month; if hire after the 15th the service starts on the beginning of the following month. In the service definition the start date is set to date of hire. The start adjustment of the service definition, the Date Adjustment can be defined as:
DayOfMonth:= #DAY #THIS & ; The day of the month is extracted from
; #THIS (the date being adjusted), in this
; case date of hire.#if DayOfMonth < 16 #then ; examine day of month, if less than 16 #BEGMTH #THIS ; make the date the beginning of the month #else ; if day of month is 16 or more then #NEXTBEGMTH #THIS ; make the date the beginning of next month #endif
If date of hire is 6/17/2011, the date adjustment will cause the starting date to be 7/1/2011.
2. Service rounding expression:
a := #THIS > .83333 &
[ #THIS * (a = 0) ] + (a = 1)
Checking the Round service earned within each measurement period box will cause ProAdmin to examine values on a calendar year basis and determine whether the amount earned is greater than ten months or 0.83333 of a year.
The temporary variable “a” will be 0 if the value is less than 10 months and 1 if it is greater. The expression “#THIS * (a = 0) yields the value computed for the calendar year when “a” is equal to 0, that is: when the value is less than 10 months. When “a” is zero, the expression (a = 1) is false or zero (0) so adding it #THIS retains the computed value.
When “a” is equal to one (1), the expression “#THIS * (a = 0) yields zero (0) since the expression (a = 0) is false or zero (0) and #THIS times zero is zero. The expression (a = 1) is true or one (1). Adding 0 to one is one.
So ProAdmin computes service on an elapsed time basis, but if more than ten months are worked, ProAdmin computes one year of service.
3. Hours or salary transformation expression:
Suppose service is granted by examining the number of hours worked in a month. Working 150 hours or more yields one month of service; otherwise the fraction: (hours worked) / (150 hours) represents a portion of a month of service. Hours are read in as an array with start and stop dates. The array has monthly values and The Service Definition has a monthly measurement period. The hours-transformation expression can be defined as:
FRACTION := 1 #MIN (#THIS/150) &
FRACTION / 12
#THIS represents the values included in the transformation expression table. In this case, the first column of the table is made up of all the stop dates and values read into the hours array variable. The table also contains measurement period end dates and values that are not included in the original array plus any other dates and values ProAdmin considers useful, such as date of hire.
The fraction #THIS/150, is limited to one, then divided by 12 to compute the portion of a year the fraction represents.
#DATE and #THIS are often used together in transformation expressions. Click on the link for more information.