Writing Formulas for Templates

There are several ways you can use formulas to configure the people management templates:

Template Validation Formulas

If you use a formula to validate user entries in template fields, you must observe the following rules:

After creating the formula, you select it in the Validation Formula property for the field when you are setting up the template in the People Management Configurator. You can also enter up to five parameters to be passed to the formula, including the value you are validating. For example, you might enter the name of another field on the template if you want the formula to cross-validate the value in one field against another.

Example

Here is a formula that validates the entry in the Organization field on the Maintenance window. It raises an error if the entry is not Corporate Finance.

/* Updateable Values Section */

/* Defaults Section */

/* Inputs Section */

INPUTS ARE item1 (text)

/* Main Body of Formula */

organization_name = item1

status = 's'

message = ' '

IF organization_name <> 'Corporate Finance' THEN

  (

message = 'Organization must be Corporate Finance'

 	status = 'f'

   )

RETURN message, status

When you are setting up the template in the People Management Configurator, select the Organization (Maintain) item. Select the name of your formula as the Validation Formula property and select Organization (Maintain) as the Validation Formula Parameter 1 property. This passes and validates the value the user enters, not any codes or table identifiers to which it may be related.

Template Information Formulas

If you write a formula to return additional information for a field, you must observe the following rules:

After creating the formula, you select it in the Information Formula property for the field when you are setting up the template in the People Management Configurator. You can also enter up to five parameters to be passed to the formula. For example, if you were specifying an information formula for the job field, you might enter the name of the organization field so that the formula can return different additional job information depending on the organization.

Example

Here is a formula that returns contact information to be displayed from the Supervisor field.

/* Updateable Values Section */

/* Defaults Section */

DEFAULT FOR sup_work_phone IS ' '

DEFAULT FOR sup_email_address IS ' '

/* Inputs Section */

/* Main Body of Formula */

message = 'Supervisor Contact Details||CHR(10)||'Telephone:

'||sup_work_phone||CHR(10)||'Email: '||sup_email_address

RETURN message

People Management Message Formula for Assignment Field

Applicant and employee assignments are listed by name in the Data Organizer in the template Summary window and in the Assignment field on the Maintenance window. Since assignments do not have names, you can choose what assignment information is displayed as a name to help your users select the assignments they want to work with.

By default, assignments are identified as <job>.<organization>, such as Senior Manager.Engineering. However, you can choose any other database items to display.

If you want to override the default, write a formula (of type People Management Message) called ASSIGNMENT_NAME. This formula must return a text string. If there is no formula called ASSIGNMENT_NAME on the database, the system uses the predefined formula QH_ASSIGNMENT_NAME.

The QH_ASSIGNMENT_NAME formula is as follows:

/* Updateable Values Section */

/* Defaults Section */

DEFAULT FOR asg_job IS ' '

DEFAULT FOR asg_org IS ' '

/* Inputs Section */

/* Main Body of Formula */

assignment_name = asg_job||'.'||asg_org

RETURN assignment_name

People Management Message Formulas for Message Tokens

If you write a formula to return messge tokens, you must observe the following rules:

Example

Suppose you want to include an employee's preferred name in a New Hire notification. The New Hire notification is called NEW_STARTER, so you create a formula of the same name that returns this name in the variable FF1:

/* Updateable Values Section */

/* Defaults Section */

DEFAULT FOR per_known_as IS ' '

/* Inputs Section */

/* Main Body of Formula */

FF1 = per_known_as

RETURN FF1

Then you edit the New Hire notification to include the FF1 variable. For example:

Please note, that we have a new employee as of &HIRE_DATE.

They are &FULL_NAME (&EMPLOYEE_NUMBER).

Known as: &FF1.

Their new job details are:

Position: &POSITION

Job: &JOB

Organization: &ORGANIZATION

Location: &LOCATION