Defining Historical Rule Elements

To define historical rule elements, use the Historical Rules (GP_HIST_RULE) component.

Page Name

Definition Name

Usage

Historical Calculation Name Page

GP_PIN

Name the element and define its basic parameters.

Historical Rules - Processing Period Page

GP_HIST_RULE1

Define the details of the processing period for the historical rule. Depending on what you select as the rule type, some fields may not be available for entry.

Parameters and Mapping Page

GP_HIST_RULE2

Define the formula for a historical rule.

You can use historical rule elements to set up rules that retrieve data from prior periods. Historical rules can be used in formulas and fictitious calculations.

A historical rule can be associated with an earning or deduction element on the Formula Definition page. It can also be associated with any element that's stored in the Earnings/Deductions results table, Accumulators results table, or Other Elements results table. A historical rule can be used by fictitious calculation elements to find periods to recalculate.

Historical rule elements, retroactive calculations, and fictitious calculation elements differ in the following ways:

  • A historical rule element enables you to set up rules that retrieve data from prior periods.

  • A retroactive calculation enables you to recalculate a prior period, and the results of that calculation are kept.

  • A fictitious calculation element enables you to recalculate a prior period, but the results are not kept and only the final amount is passed to the current period.

To define a historical rule:

  1. Define the naming information for the historical rule on the Historical Rules Name page.

  2. Define the rule type and the periods to be processed on the Processing Period page.

  3. Define the formula for a historical rule on the Parameters and Mapping page.

You can attach a historical rule to an earning or deduction element on the Formula Definition page or to any element that's stored in the Global Payroll Earnings/Deductions results table (GP_RSLT_ERN_DED), Global Payroll Accumulators results table (GP_RSLT_ACUM), or Global Payroll Other Elements results table (GP_RSLT_PIN). In addition, a historical rule can be used by fictitious calculation elements to find periods to recalculate.

Warning! The historical rule element reads the maximum version and the maximum revision in the payroll results. So, when an element is recalculated retroactively using forwarding retro, the delta is both included in the recalculated element and then forwarded to the current period. It is then included twice in the results read by the historical rule.

To bypass this issue you can select to Use Corrective Retroactive Behavior for segment accumulators on the Accumulator – Level page.

A historical rule resolves to one if it's successful and to zero if it's not successful. This works the same way as an array element. A historical rule can then be used in a formula such as:

IF HIST_RULE_TEST =1, THEN

Use variable elements populated by historical rule

ELSE

Generate an error

END-IF

A historical rule is set to one when either the end-of-process formula resolves without errors, or if that formula is not used in the processes, the stop-process-if-true variable is set to TRUE.

In all other situations, a historical rule is set to zero and SQL returns no data.

How the System Processes Historical Rule Elements

Here's how the system processes historical rules:

  1. The system dynamically creates SQL to load elements requested from the Global Payroll result tables.

    It can get data from multiple result tables at one time by using a SQL UNION, meaning direct access to the database each time the historical rule is called. A SELECT and a series of FETCHES are performed each time. The use of this element type affects performance.

  2. The system maps columns to variables.

    The variables are available for use in a formula.

  3. The first fetch establishes the keys for the first retrieved segment.

    The program continues fetching records until there is a break in the segment keys. It then populates the input and output interface copybook (PINL) with the values for the retrieved elements or with the null values for the elements in the element mapping that were not found. Then the program requests the resolution of Formula to Execute By Segment.

  4. The system performs formula resolution per segment.

  5. The system resolves an end of process formula for additional calculations such as averaging.

This table lists how calendars and segments are processed in the reverse order in which they were initially run:

Original Processing Sequence

Processing Sequence for Historical Rules

January absence calendar

January payroll calendar (segment 1, segment 2)

February absence calendar

February payroll calendar

February payroll calendar

February absence calendar

January payroll calendar (segment 2, segment 1)

January absence calendar

Formulas Used to Calculate the Preceding Values

Formulas to run by period (CUM_COMP):

  • CUM_PERIOD_SAL + CUR_SAL = CUM_PERIOD_SAL, where you calculate the earning value.

  • CUM_NUM_PERIODS + 1 = CUM_NUM_PERIODS, where you calculate the period of time.

Formula to calculate at the end (AVG_COMP):

CUM_PERIOD_SAL/CUM_NUM_PERIODS = AVG_COMP, where you calculate the earning value divided by the period of time.

Use the Historical Calculation Name page (GP_PIN) to name the element and define its basic parameters.

Navigation:

Set Up HCM > Product Related > Global Payroll & Absence Mgmt > Elements > Supporting Elements > Historical Rules > Historical Calculation Name

Note: You name every element and define its basic parameters on an element name page with the object name of GP_PIN. The page title and general appearance of this page change based on the type of Global Payroll element that you are naming and defining. All of the fields on this page are documented in another topic in this product documentation.

Use the Historical Rules - Processing Period page (GP_HIST_RULE1) to define the details of the processing period for the historical rule.

Depending on what you select as the rule type, some fields may not be available for entry.

Navigation:

Set Up HCM > Product Related > Global Payroll & Absence Mgmt > Elements > Supporting Elements > Historical Rules > Processing Period

This example illustrates the fields and controls on the Historical Rules - Processing Period page.

Historical Rules - Processing Period page

Note: On the Processing Period page, you create the periods from the date from to the date to date. You then map the selected result data to the processing periods. If no data exists for an element in a period, it is set to spaces for character and date elements and to zeros for numeric and monetary elements.

Field or Control

Description

Rule Type

Select the type of historical rule from these options:

Use in Fictitious Calculation: Select when you want to use a historical rule element in a fictitious calculation element to determine which pay periods to recalculate.

Retrieve Values: Select when you want to use a historical rule element in a formula to retrieve previously calculated values.

Go back from Date Range

Define the date from, date to type, date from element, and date to element to establish the rule's date range. If you select a Retrieve Values rule type, this field appears as Go Back From Date Range. If you select a Use in Fictitious Calculation rule type, this field appears as Go Forward From Date Range.

Select from the following values in the Date From Type and Date To Type fields:

Bracket

Cal Date (calendar date): Enter a date instead of an element that resolves to a date. In the next field, specify the date to start going back from (for historical rules) or to start going forward from (for fictitious rules).

Date

Formula

SystemElem (system element)

Variable

Use Based On

Select a date that tells the system which data values from the GP_RSLT tables are processed by a historical rule. Select from these values: Period End Date, Period Begin Date or Payment Date.

Log statement at run time

Select this check box to see the text of the SQL statement dynamically generated by the array module during batch processing. You can direct the output display into a file by selecting the Redirect Output option in PeopleTools Configuration Manager.

Example

You want to determine three months of salary (element SALARY) for the period between March 28 and June 27. This table lists the GP_RSLT table values:

Period Payment Date

Result

Period Begin

Period End Date

Payment Date

January 2003

100

January 1, 2003

January 31, 2003

February 2, 2003

February 2003

100

February 1, 2003

February 28, 2003

March 2, 2003

March 2003

100

March 1, 2003

March 31, 2003

April 2, 2003

April 2003

100

April 1, 2003

April 30, 2003

May 2, 2003

May 2003

100

May 1, 2003

May 31, 2003

June 2, 2003

June 2003

100

June 1, 2003

June 30, 2003

July 2, 2003

July 2003

100

July 1, 2003

July 31, 2003

August 2, 2003

If you select Period Begin Date, the historical rule processes only June, May, and April. It does not process July, because July 1, 2003 (the period begin date) is later than the date from date of the historical period (June 27, 2003). It also does not process March, because March 1, 2003 (the period begin date) is before the date to date of the historical period (March 28, 2003).

Note: Historical rules start from the date from date and look at periods and segments in the reverse order in which they were originally processed and go back to the date to date.

If you select Period End Date, the rule processes May, April, and March. It does not process June, because June 30, 2003 (the period end date) is later than the date from date of the historical period (June 27, 2003). It also does not process February, because February 28, 2003 (the period end date) is before the date to date of the historical period (March 28, 2003).

If you select Payment Date, the rule processes May, April, and March. It does not process June, because July 2, 2003 (the payment date) is later than the date from date of the historical period (June 27, 2003). It also does not process February, because March 2, 2003 (the payment date) is before the date to date of the historical period (March 28, 2003).

See PeopleTools: Data Management.

Use the Parameters and Mapping page (GP_HIST_RULE2) to define the formula for a historical rule.

Navigation:

Set Up HCM > Product Related > Global Payroll & Absence Mgmt > Elements > Supporting Elements > Historical Rules > Parameters and Mapping

This example illustrates the fields and controls on the Parameters and Mapping page.

Parameters and Mapping page

Note: Depending on whether you specified a historical or fictitious rule type on the Processing Period page, different fields appear on this page.

When you run a payroll, the system resolves the Formula to Execute by Segment field per historical period until the Stop Process If True variable is not equal to zero or the last historical period is processed. The system then resolves the formula specified in the Formula To Execute at End field.

Field or Control

Description

Formula to Execute By Segment

Enter the formula to be resolved for each segment or period.

Stop Process If True

Enter a variable. The process keeps looping through periods, resolving the formula for each period, until this variable doesn't equal zero, the date to date is reached, or no more data is found.

Formula To Execute At End

Select the formula to resolve when period processing is completed.

Use Period If True

This field appears for Use in Fictitious Calculation rule types only. Enter a variable. After each call to the Formula to Execute By Segment field, this variable is checked for zero or one. If it's set to one, the fictitious calculation process uses the period for which the formula was called.

Element Mapping

The grid in the Element Mapping group box lists the elements for retrieval from the Global Payroll result tables for a historical rule.

Field or Control

Description

Element Type

Select the type of element—such as the earning, deduction, or variable—to retrieve.

Historical Period Element

Enter the element that you want to retrieve.

Current Period Element

Enter the variable in which the retrieved value is to be stored. This variable becomes available for use in the Formula to Execute By Segment field.

Slice Option

Specify how the system resolves multiple instances of an element in the historical period. Values are:

  • Sum Slices: The system sums all slices.

  • Use Last Slice: The system uses the value of only the last slice.

  • Sum Slices - Current Empl Rcd: The system sums all slices, but only for rows of data where the EMPL_RCD equals the current EMPL_RCD.

  • Use Last Slice - Cur. Empl Rcd: The system uses the value of only the last slice, but only for rows of data where the EMPL_RCD equals the current EMPL_RCD.