Tuesday, March 21, 2017

How to debug a Fast Formula

How to Debug the Fast Formula
There are many ways the Fast Formula can be debugged. The different teams that use Fast formula provided different method to debug the formula.  We try to go through the most commonly used methods to debug the Fast Formula.
Some of these methods may be obsolete or not available in your version. Please confirm with your support/document about the usage of these methods.

ESS_LOG_WRITE
Syntax:  l_var = ESS_LOG_WRITE(‘Test Fast Formula’)
This is the Most commonly used method to debug the fast formula. The output of this method is written in the ESS Log.  The limitation of this method is that the method is not useful unless the Fast Formula is processed by the ESS. In other word if the Fast Formula is executed from the UI, this method cannot create any logs.
How to see these logs:
Every team provides an option see the ESS progress (Monitor Page). The navigation path may differ for each team. We take the Compensation page as example to show how the ESS logs can be viewed.
In Compensation Home Page, chose the Run Batch Process.
In the Run Batch Process page, Click on Monitor Process button.
In the monitor page, we turn Hierarchy flag on, which is our preferred way of seeing the process but it is up to your preference. The Fast Formula are processed by Child Process in Compensation, it may be different in other process. Select the child process. You can see the details in the end of the screen; you may need to go to the end, in case if you have too many processes.  In the End you see the attachment as ESS_L_99999.
In some versions, you need to select the process and click the View Log button to see the log file.


HR_TRACE/HRTRACE:
Syntax:  l_var = HR_TRACE (‘Test Fast Formula’)    or l_var = HRTRACE (‘Test Fast Formula’)
HR_TRACE is the method name and HTRACE is the alias for the method. You can use either the name to execute this method.  This method works only if you have setup a PLSQL trace on. This will create an output File as you define in your debug setup. This debug setup also enables the debug for entire PL/SQL process.  This method returns ‘TRUE’ if the log is written otherwise ‘FALSE’. The limitation of this method is, you need to enable the PL/SQL debuger and needs to have DB structure access to retrieve the output file or you need to know someone who can do that for you.  If you do not know how to turn on the debugger please talk to your support to provide the document.

PAY_INTERNAL_LOG_WRITE:
Syntax:  l_var = PAY_INTERNAL_LOG_WRITE(;Test Fast Formula’).
This method is provided by Payroll, it is an alternative to ESS_LOG_WRITE. This is available only for payroll process. The payroll document describes the method as ‘If your formulas are executed from the Payroll Run you can set the F flag for Payroll debug and make PAY_INTERNAL_LOG_WRITE formula function calls to output the messages to the ESS log file.’
DEBUG:
Syntax:  l_var = debug(Test Fast Formula’).
This is a clone of HR_TRACE. 
US_FORMULA_LOGGING/CA_FORMULA_LOGGING:
Syntax:  l_var = XX_FORMULA_LOGGING (‘CODE’, ‘Test Fast Formula’).
These methods accepts two parameters, code and message. The code is expected to be more than three characters.
For Simple User, this is same as HR_TRACE,
ADD_RLOG:
Syntax:  l_num = ADD_RLOG (ff_id,rule_id, ‘Test Fast Formula’).
This method is provided by Oracle Time and Labor (OTL) Team. This method accepts three parameters, Formula Id, Rule ID and the message. The logs are written in to one of their table. The method returns the number 1.
You can get the ff_id and rule_id from the context HWM_FFS_ID, and HWM_RULE_ID
ADD_LOG
Syntax:  l_num = ADD_LOG (ff_id, ‘Test Fast Formula’).
This is a subset of ADD_RLOG method. The Rule_id is internally determined by this method. The functionality is same as ADD_RLOG.
 How to See OTL  Logs: 
 From Navigator, select 'Workforce Management' > 'Time Management'
From Time Management, select 'Analyze Rule Processing Details'
On search screen, select Rule set name, click search
On search results, click on Time card Processing Id to view detail
On Analyze Rule Processing Details page you can look at the  Rule processing log.

Hope this helps

15 comments:

  1. Hi Tilak and Lakshmi,

    We have a series of 8-10 fast formulas which needs to be replicated across 5-6 plans, with a minor change to the “hardcoding” within each of the set of fast formulas.
    Is there a way to use the same FF across multiple plans, but the hardcoding within the FF will have to be replaced dynamically depending on the plan in which it is used.


    Warm Regards
    Shyam

    ReplyDelete
    Replies
    1. hi Shayam.

      You have not mentioned the formula type. The "plan" is a very common word across compensation, benefit and absence modules.

      pls provide more information.

      Delete
    2. Thanks Tilak, Each of the Fast Formulas are of type ‘Compensation Default and Override’, written to retrieve the values from assignment data.
      Plan here refers to Compensation plan, which is different for every business unit inside the assignment. 

      Warm Regards
      Shyam

      Delete
    3. Still Your information is very limited for me to suggest a solution. Let me see whether I can guess it right.
      As per my understanding,
      1)You want to use the same Formula for multiple plan.
      2) Some calculation or value may vary from plan to plan.
      3)You do not want to hard code the plan to differentiate the value/calculation.

      If my understanding is correct. You have three input values to work on
      1) CMP_IV_PLAN_ID, 2) CMP_IV_PERIOD_ID, 3) CMP_IV_ITEM_NAME.

      Here first two input values are ID and the third one is Name.
      You can use one or all of the above value to differentiate the call.

      Since you do not want to hard code the condition in your formula. You can use the payroll user defined table, where you define your calculated value based on the input values and you can fetch the value by using the function GET_TABLE_VALUE.

      In case if you are finding it hard to use the ID to work, you can get the name of the plan by using payroll functionality, value set (pls see my blog on sep, 2016, FF without DBI).

      If the above reply is not sufficient, you may need to provide a sample formula or an example to explain me more about your issue.

      Delete
  2. Thanks a lot Tilak and Lakshmi. Created user defined table, but not sure if we got it correct. Are we supposed to write SQL statement to fetch the column/ row values ? What does Exact and Value mean? Please help!!
    Warm Regards
    Shyam

    ReplyDelete
    Replies
    1. Please use the function get_table_value
      it supports the following parameters
      1) table name
      2) Column Name
      3) Row Value
      4) Default value (in case the function could not found a value)

      Hope this solves your issue (please read the blogs, these are already in there)

      Delete
  3. Hi Tilak,

    Can a fast formula invoke another fast formula (which is specific to an LDG)? If yes, how do we do that?

    Thanks,
    -Manikandan

    ReplyDelete
    Replies
    1. Please read my blog on parent child: http://tilak-lakshmi.blogspot.com/2016/03/parent-and-child-formula.html

      Delete
  4. HI Tilak,

    when employee has two or more part time assignments and he/she creates new absence, absence duration is multiplied. Can you pls help me out on this. This is from Fusion HCM.

    ReplyDelete
    Replies
    1. Ramesh,

      your description of the issue is not sufficient for me to help you.
      Please elaborate issue related to Fast Formula.
      Are you using a DBI or a function to get the duration ?
      How the Abs Duration is calculated ?

      Delete
    2. In Oracle Fusion HCM , if employee has 2 active assignment and apply leave for one day in Basic Mode it calculates to two days.

      Delete
    3. I am not an absence guy. Unless you let me know what calculates the values, I dont know.
      Either let me know how the calculation takes place (DBI, function ) or provide me your formula.

      Delete
  5. Hi Tilak and Lakshmi,

    We have created a fast formula but the problem is that fast formula is not getting triggered from hcm extract. I have put log messages, those are not printed. While running the extract null values are printed in that field where formula is used and there are no errors as well.

    Any thoughts on this. Sad part is this issue came in production and is not replicable in Dev or Test.

    ReplyDelete
    Replies
    1. Look like a setup issue. Can you pls contact Extract support.

      Have you re-generated ( don't know what is the exact term used) the Extract ?

      Delete
  6. l_log = PAY_INTERNAL_LOG_WRITE('(GLBEARN) ENTRY_LEVEL : '||ENTRY_LEVEL) is creating the balance but all values are zero. What might be reason. This is fast formula for percentage calculation. It is not getting salary value from balance equal to zero and hence % allowance cannot be calculated

    ReplyDelete