Element Input Validation Formula Type
You can use an element input validation formula to validate one or more element entry values. You can also use this formula type to provide a default value for an element entry value.
Additionally, you can calculate entry values based onthe user's entries in other entry values.
You select the formula on the Element Summary page in these fields:
Page Section |
Field |
Purpose |
When Does the Formula Run? |
---|---|---|---|
Element Details or Element Eligibility |
Validation Formula |
Validates one or more entry values for the element based on entries in other entry values. |
When you save the element entry. |
Element Details or Element Eligibility |
Calculation Formula |
Provides values for one or more entry values using a calculation formula that takes input from these entry values or other entry values. |
When you save the element entry. |
Element Details or Element Eligibility |
Defaulting Formula |
Provides default values for one or more entry values. |
When you create the element entry. |
Input Value |
Validation Formula |
Validates one entry value independent of others. |
When you enter a value. |
A formula at the element eligibility level always overrides an equivalent formula at the element level.
Here are the contexts that are available to all formulas of this type:
-
LEGISLATIVE_DATA_GROUP_ID
-
DATE_EARNED
-
EFFECTIVE_DATE
These contexts are available to formulas only at element or element eligibility level; they aren’t available to validation formulas at the input value level:
-
PERSON_ID
-
PAYROLL_RELATIONSHIP_ID
-
PAYROLL_TERM_ID
-
PAYROLL_ASSIGNMENT_ID
-
HR_RELATIONSHIP_ID
-
HR_TERM_ID
-
HR_ASSIGNMENT_ID
Here are the input variables that are available to formulas of this type.
Formula Usage |
Input Variables |
Comments |
---|---|---|
Validation formula at input value level |
|
Passes the value to be validated. You must declare the input variable as the appropriate type for the element input value. |
Validation formula at element or element eligibility level |
Any element input value name that corresponds to an entry value. |
Replace spaces in the input value name with underscores in the input variable name. It doesn't matter whether you use uppercase or lowercase for the name. |
Defaulting formula |
None |
Use database items or other logic instead. |
Calculation formula |
Any element input value name of an entry value. |
Replace spaces with underscores. You need not provide all of the available entry values. |
Here are the return values that are available to formulas of this type.
Formula Usage |
Return Values |
Comments |
---|---|---|
Validation formula at any level. |
|
Must be either 'S' (success) or 'E' (error). Required. |
Validation formula at any level. |
|
The text of the message is passed to the user if the validation fails. Optional. |
Defaulting formula |
Any element input value name of an entry value. |
A return value overrides any default value that’s provided on the input value in the element or element eligibility record. |
Calculation formula |
Any element input value name of an entry value. |
You don't need to return all of the available entry values. You can return the entry values that were passed as input variables or other entry values. |
Here are a few sample formula that you can use:
-
Validation formula at input value level
-
Validation formula at element or element eligibility level
-
Calculation formula at element or element eligibility level
-
Defaulting formula at element or element eligibility level
Validation formula at input value level:
inputs are entry_value(date)
if(entry_value = '01-APR-2008' (date)) then
(
formula_message = 'Valid date'
formula_status = 'S'
)
else(formula_message = 'Invalid date'
formula_status = 'E'
)
return formula_message, formula_status
Validation formula at element or element eligibility level:
inputs are hours_worked, rate, earning_date(date), comment(text)
if(hours_worked > 80) then
(
formula_message = 'You are within the working limit.
'formula_status = 'S'
)
else
(
formula_message = 'You have worked too many hours.
'formula_status = 'E'
)
return formula_message, formula_status
Calculation formula at element or element eligibility level:
inputs are hours_worked, rate, comment(text)
if(hours_worked > 80) then
(
rate = rate * 1.2
comment = 'Your rate has been increased'
)
return rate, comment
Defaulting formula at element or element eligibility level:
if(CATEGORY = 'S') then
(
rate = 20
)
else
(
rate = 30
)
rate_code = 'B'
return rate, rate_code