Communicating between Fast Formulas
Communicating between Fast Formulas
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:
Steps for FTE Salary Fast Formula:
1. We get the Annual salary from the Annual Salary DBI.
2. Get the FTE value from the FTE DBI.
3. If the DBI is not null or 1, then divide the Annual salary with FTE.
4. If the Salary is defined for Hourly, then multiply the salary with FTE.
5. 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.
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:
1. WSA_EXISTS
2. WSA_DELETE
3. WSA_SET
4. 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)
TCS Setups:
Item:
Category Setup
Statement Setup
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.
Hope this has helped you with an understanding of WSA and how communicating between Fast Formulas is possible. As always, if
you have any questions or suggestions, please feel free to comment.