0% found this document useful (0 votes)
12 views

Using Global Variables in Fast Formula -WSA

The document explains how to use global variables in Fast Formula to enable communication between different Fast Formulas within the same session. It provides a hypothetical use case involving the calculation of Annual FTE Salary and Bonus, detailing the steps for both the Salary and Bonus Fast Formulas, including the use of the Working Storage Area (WSA) methods. The document also includes sample code and execution logs demonstrating the successful passing of values between the formulas.

Uploaded by

balasuk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Using Global Variables in Fast Formula -WSA

The document explains how to use global variables in Fast Formula to enable communication between different Fast Formulas within the same session. It provides a hypothetical use case involving the calculation of Annual FTE Salary and Bonus, detailing the steps for both the Salary and Bonus Fast Formulas, including the use of the Working Storage Area (WSA) methods. The document also includes sample code and execution logs demonstrating the successful passing of values between the formulas.

Uploaded by

balasuk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1

Using Global Variables in Fast Formula -WSA

Fast Formula – WSA

In this session, we will explain how to talk to another Fast Formula that is executed in the same session.
In many processes, we define more than one Fast Formula and sometimes these Fast Formulas execute the same
routine again and again. This can be avoided if we could talk to each other or if we can pass a value between
Fast Formulas.

We will explain this concept with a hypothetical use case.


Assume Total Compensation Statement needs to calculate the Annual FTE (Full Time Equivalent) Salary and
Bonus for every person. The Bonus is 20% of the Annual FTE Salary.

In the above example, the Annual FTE needs to be calculated in the Salary Fast Formula and the Bonus Fast
Formula. Instead of doing the calculation in every Fast Formula, we want to calculate the Annual FTE salary in
the Fast Formula that is executed first and pass the value to the Fast Formula that is executed later.

As per the setup, we assume, the Annual FTE Salary Fast Formula is executed first and the Bonus Fast Formula
is executed later. To find out which process is executed first, you can run the process for a person and the Fast
Formula ESS Logs can help you.

How we achieved this requirement:

1. Steps for FTE Salary Fast Formula:


2. We get the Annual salary from the Annual Salary DBI.
3. Get the FTE value from the FTE DBI.
4. If the DBI is not null or 1, then divide the Annual salary with FTE
5. If the Salary is defined for Hourly, then multiply the salary with FTE.
6. Set the value in Working Storage Area using the function WSA_SET(<item>, <value>).

Steps for Bonus Fast Formula:

1. Check the salary WSA Item exists by using WSA_EXISTS(<item>).


2. If the WSA exists, get the value from WSA by using WSA_GET(<item>, <default-value>).
3. Otherwise, calculate the value from the DBI.
4. If the WSA exists, delete the WSA by using WSA_DELETE(<item>) so that we make sure the WSA
value is not used for the next person.

1
2

What is WSA:

As per the Fast Formula documentation,

“The working storage area is a mechanism for storing global values across
formulas. The values are accessed by name. The names are case-independent”.

There are four working storage area methods:

WSA_SET
WSA_EXISTS
WSA_DELETE
WSA_GET

FTE Salary Fast Formula:

/*

Author : Ti(lak)shmi
Type : Total Compensation Item
NAME : TCS_FTE_SAL_TEST_FF
Remarks: This formula is for demonstrating the communication between Fast Formulas.
This formula calculates the Full time FTE salary and assigns it to a WSA Variable.

*/

DEFAULT FOR CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT IS -1


DEFAULT FOR PER_ASG_FTE_VALUE IS 1
INPUTS ARE CMP_IV_PERIOD_START_DATE (DATE) ,CMP_IV_PERIOD_END_DATE (DATE)

L_DATA = ESS_LOG_WRITE( 'BEGIN CS_FTE_SAL_TEST_FF' )


COMPENSATION_DATES = TO_CHAR(CMP_IV_PERIOD_END_DATE, 'YYYY/MM/DD')
VALUES = 0
IF (CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT WAS NOT DEFAULTED ) THEN
(

VALUES = CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT
IF (PER_ASG_FTE_VALUE WAS NOT DEFAULTED) THEN
(
VALUES = VALUES * PER_ASG_FTE_VALUE
)

L_DATA = ESS_LOG_WRITE( 'Salary Amount is ' + TO_CHAR(VALUES) )


WSA_SET('TCS_WSA_TEST_FTE_SALARY', VALUES)

) ELSE (
L_DATA = ESS_LOG_WRITE( 'Salary Amount is 0 to test WSA ' )
WSA_SET('TCS_WSA_TEST_FTE_SALARY', VALUES)
)

L_DATA = ESS_LOG_WRITE( 'END CS_FTE_SAL_TEST_FF' )

2
3

RETURN COMPENSATION_DATES ,VALUE


Bonus Fast Formula:
/*
Author : Ti(lak)shmi
Type : Total Compensation Item
NAME : TCS_BONUS_TEST_FF
Remarks: This formula is for demonstrating the communication between Fast Formulas.
This formula gets the salary value that is calculated at TCS_FTE_SAL_TEST_FF by using WSA.
*/
INPUTS ARE CMP_IV_PERIOD_START_DATE (DATE) ,CMP_IV_PERIOD_END_DATE (DATE)
L_DATA = ESS_LOG_WRITE( 'BEGIN TCS_BONUS_TEST_FF' )
COMPENSATION_DATES = CMP_IV_PERIOD_END_DATE
VALUES = 0
IF WSA_EXISTS('TCS_WSA_TEST_FTE_SALARY' ) THEN
(
L_DATA = ESS_LOG_WRITE( 'WSA FOUND' )
VALUES = WSA_GET('TCS_WSA_TEST_FTE_SALARY', 0 )
L_DATA = ESS_LOG_WRITE( 'WSA VALUE ' + TO_CHAR(VALUES))
IF (VALUES != 0 ) THEN
(
VALUES = VALUES * .20
L_DATA = ESS_LOG_WRITE( 'Bonus Amount ' + TO_CHAR(VALUES))
)

WSA_DELETE('TCS_WSA_TEST_FTE_SALARY' )
)
L_DATA = ESS_LOG_WRITE( 'END TCS_BONUS_TEST_FF' )
RETURN COMPENSATION_DATES ,VALUE

TCS Setups:
Item:

3
4

Category Setup

Statement Setup

Sample Log for the Formula Execution

BEGIN CS_FTE_SAL_TEST_FF
Salary Amount is 54963
END CS_FTE_SAL_TEST_FF
BEGIN TCS_BONUS_TEST_FF
WSA FOUND
WSA VALUE 54963
Bonus Amount 10992.6
END TCS_BONUS_TEST_FF

As per the log, Salary Fast Formula calculated the Salary and assigned the Salary value to a WSA Variable and
the Bonus Fast Formula was able to get the value from the WSA Variable.
4

You might also like